I am not sure if this is possible, but I need to make a dirty hack. Assume I am invoking php from cli
php script.php one two
then in script.php I am doing something with two parameter, and then I would like to remove it, so the third party code that is included later on thought, that the initial command was
php script.php one
I tried unset($argv[2]) and unset($GLOBALS['argv'][2]) but this does not work. Is it after all possible what I am trying to do ?
UPDATE: Does not work = I get exception from third party code "Too many arguments"
UPDATE: of course it should be argv[1], but it is a typo only in this question, not in the actual problem. Please assume I have written argv[1] :)
You're trying to remove the third element with unset($argv[2]).
Array are zero-based. So to remove the second element use:
unset($argv[1])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With