PDA

Click to See Complete Forum and Search --> : File arguments


nebulom
Jul 30th, 2007, 10:08 PM
If I run the PHP interpreter like this

php some.php something

Can I get the "something" like I get it with static void Main(string[] args) on other language?

Thanks.

nebulom
Jul 31st, 2007, 12:15 AM
It's $_SERVER['argv']

RudiVisser
Aug 2nd, 2007, 05:37 AM
You can use $argv for the argument values, and $argc for the argument count. :)

penagate
Aug 2nd, 2007, 05:53 AM
You can use $argv for the argument values, and $argc for the argument count. :)
Yes, as long as register_argc_argv is on.
Using $_SERVER is preferable as you can rely on that being available.

RudiVisser
Aug 2nd, 2007, 05:59 AM
I've never seen a server of which that isn't available, plus it's enabled by default and there's no reason to change it.