you can use the $ argv array. eg:
<?php echo $argv[1]; ?>
remember that the first member of the $ argv array (which is $ argv [0]) is the name of the script itself, so in order to use the parameters for the application, you must start using the $ argv [] members from the '1st index. when invoking the application, use this syntax:
php myscript.php -- myValue
no need to specify a name for the parameter. as you saw, what you called var_dump () on $ argv [], the second element (which is the first parameter) is the line PARAM = TEST. correctly? therefore, there is no need to specify a name for the parameter. just enter the parameter value.
farzad
source share