Skip to content

Baxleys.org

  • Home
  • About
  • Yelp
  • Facebook
  • Twitter
  • Instagram
  • Email

Tag: CLI

Finding comand line arguments in PHP script

A good way to look for particular arguments passed on the command line to a PHP script.

The code below will grab the -f argument and stick it in the $filename variable.

<code>
$filename = ”;
for ( $c=0; $c<$argc; $c++) {
if ( $argv[$c] == ‘-f’ ) {
$filename = $argv[$c + 1];
break;
}
}
</code>

Author NatePosted on September 10, 2008Categories TechnologyTags CLI, PHP, Programming

Search

About This Site

This site is our little soapbox.  We post about anything we want to share with the world.  Hopefully we put up something you find interesting.

  • Home
  • About
  • Yelp
  • Facebook
  • Twitter
  • Instagram
  • Email
Baxleys.org Proudly powered by WordPress