note 105491 added to reserved.variables.argv
| From: | tufan dot oezduman at googlemail dot com | Date: | Mon, 22 Aug 2011 16:06:45 +0000 |
| Subject: | note 105491 added to reserved.variables.argv | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-182653@lists.php.net to get a copy of this message | ||
Please note that, $argv and $argc need to be declared global, while trying to access within a class
method.
<?php
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.
----
Server IP: 212.124.37.9
Probable Submitter: 217.91.51.80
----
Manual Page -- http://www.php.net/manual/en/reserved.variables.argv.php
Edit -- https://master.php.net/note/edit/105491
Del: integrated -- https://master.php.net/note/delete/105491/integrated
Del: useless -- https://master.php.net/note/delete/105491/useless
Del: bad code -- https://master.php.net/note/delete/105491/bad+code
Del: spam -- https://master.php.net/note/delete/105491/spam
Del: non-english -- https://master.php.net/note/delete/105491/non-english
Del: in docs -- https://master.php.net/note/delete/105491/in+docs
Del: other reasons-- https://master.php.net/note/delete/105491
Reject -- https://master.php.net/note/reject/105491
Search -- https://master.php.net/manage/user-notes.php