Problem with $GLOBALS
| From: | Jim George | Date: | Sat, 17 May 2003 23:11:05 +0000 |
| Subject: | Problem with $GLOBALS | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-19988@lists.php.net to get a copy of this message | ||
Folks,
I'm a total newbie with PHP and I've been working through "SAMS Teach
yourself PHP in 24 hours".
I got to Hour 9 where they introduced the concept of predefined variables
and the $GLOBALS variable. Neither of these appear to work generating all
sorts of errors.
Please find below a listing. Can someone help me please?
Thanks.
Jim
<?php
print "<p>Let's try that loop again<br>";
$user1="Harry";
$user2="Mary";
$user3="Bob";
foreach($GLOBALS as $key=>$value){
print "\$GLOBALS[\"$key\"] == $value";
}
?>