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>