Sometimes $argv can be null, such as when "register-argc-argv" is set to false. In some cases I've found the variable is populated correctly when running "php-cli" instead of just "php" from the command line (or cron).

If your script is read from standard input or with the -r option, $argv[0] will be "-".

If you use the "--" option to separate PHP's arguments from your script's arguments, $argv[1] will be "--" if your script is read from a file. But if your script is read from standard input or with the -r option, the "--" will be removed.