Re: $GLOBAL question
| From: | Jonathan Pitcher | Date: | Mon, 18 Aug 2003 17:48:51 +0000 |
| Subject: | Re: $GLOBAL question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-159940@lists.php.net to get a copy of this message | ||
Robin,
There are 2 problems with the example you provided.
One, $GLOBAL should be $GLOBALS.
Second you can't print a value that has not been set. See updated code for an example.
<?PHP
$aTest = "This is a test";
$GLOBALS['aTest'] = $aTest;
function GlobalCheck()
{
print "{$GLOBALS['aTest']}";
}
GlobalCheck();
?>
HTH
Jonathan Pitcher
On Monday, August 18, 2003, at 12:40 PM, Robin Kopetzky wrote:
Good Morning!! I'm trying to print $GLOBALs this way and it doesn't work: <?php$aTest = "This is a test";function GlobalCheck() { print "{$GLOBAL['aTest']}"; }GlobalCheck();?> Does someone know the 'right' way to do this?? Robin 'Sparky' Kopetzky Black Mesa Computers/Internet Service Grants, NM 87020 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php