Re: $GLOBALS
| From: | Adam Goossens | Date: | Fri, 13 Jun 2003 00:13:28 +0000 |
| Subject: | Re: $GLOBALS | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-20295@lists.php.net to get a copy of this message | ||
Mike,
The $GLOBALS array contains references to all variables defined in the global
scope. By using the keyword global, you define a variable in the global scope
(and then make it accessible through $GLOBALS).
The superglobals (eg _POST, _GET, etc) don't get this automatically, because
they are "scopeless".
It would only work if you used the following code beforehand:
global $_POST['photo'];
hth.
--
Adam Goossens
=======================================
Quoting php-windows-digest-help@lists.php.net:
>
>When running the following code:
>
>foreach($GLOBALS['photo'] as $photo)
>
>I get:
>
>Warning: Invalid argument supplied for foreach() on line 63
>
>Would register globals have to be on for this code to work? Am I using the
>$GLOBALS clause wrong? It would seem to me that this should work since you
>can use post in the same fashion.
>ie: foreach($_POST['photo'] as $photo)
>
>~ Mike
-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/