Using $argc and $argv in CLI PHP : argv « Utility Function « PHP






Using $argc and $argv in CLI PHP

 
<?php
    if(!isset($argv[1]) || ($argv[1] != "-d")) {
        echo "Usage:\n";
        echo "\n{$argv[0]} -d\n";
        exit(-1);
    }
    echo "You passed the command line argument '-d'\n";
    exit(0);
?>
  
  








Related examples in the same category

1.Parsing commmand-line arguments