Please note that, $argv and $argc need to be declared global, while trying to access within a class method.
class A
{
public static function b[]
{
var_dump[$argv];
var_dump[isset[$argv]];
}
}
A::b[];
?>
will output NULL bool[false] with a notice of "Undefined variable ..."
whereas global $argv fixes that.
This posting is not a php-only problem, but hopefully will save someone a few hours of headaches. Running on MacOS [although this could happen on any *nix I suppose], I was unable to get the script to execute without specifically envoking php from the command line:
[macg4:valencia/jobs] tim% test.php
./test.php: Command not found.
However, it worked just fine when php was envoked on the command line:
________số 8
Was file access mode set for executable? Yup.
class A
0
{
public static function b[]
{
var_dump[$argv];
var_dump[isset[$argv]];
}
}
class A
1
{
public static function b[]
{
var_dump[$argv];
var_dump[isset[$argv]];
}
}
class A
2
{
public static function b[]
{
var_dump[$argv];
var_dump[isset[$argv]];
}
}
class A
3
{
public static function b[]
{
var_dump[$argv];
var_dump[isset[$argv]];
}
}
class A
4
{
public static function b[]
{
var_dump[$argv];
var_dump[isset[$argv]];
}
}
[macg4:valencia/jobs] tim% test.php
0
./test.php: Command not found.
[macg4:valencia/jobs] tim% test.php
1
./test.php: Command not found.
class A
7
{
public static function b[]
{
var_dump[$argv];
var_dump[isset[$argv]];
}
}
class A
8
{
public static function b[]
{
var_dump[$argv];
var_dump[isset[$argv]];
}
}
class A
9
{
public static function b[]
{
var_dump[$argv];
var_dump[isset[$argv]];
}
}
A::b[];
0
?>
A::b[];
1
?>
A::b[];
2
?>
A::b[];
3
?>