<?php
if ($argc != 2 || in_array($argv[1], array('--help', '-help', '-h', '-?'))) {
?>
This is a command line PHP script with one option.
Usage:
<?php echo $argv[0]; ?> <option>
<option> can be some word you would like
to print out. With the --help, -help, -h,
or -? options, you can get this help.
<?php
} else {
echo $argv[1];
}
?>
Thursday, September 25, 2008
PHP Sample Command Line Scrip
Some co-workers of mine didn't believe that PHP could be used from the command line. I was rather suprised by this, and thought others might be under the same impression. To help spread the word, here's a very simple example of a php script meant to be run from the command line.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment