Hi All,

My system: Windows NT 5.0 build 2195 / Apache/1.3.23 - PHP 4.1.1

Here is a nice snippet:
___________________________________________________________________________
<?
function test() {
 $GLOBALS['test'] = 1;
 $test = 2; }

test();
echo $test;
?>
__________________________________________________________________________

the result: 1 (however, I expected to see "2")




If I change to:
<?
function test() {
 global $test;
 $GLOBALS['test'] = 1;
 $test = 2; }

test();
echo $test;
?>
___________________________________________________________________________

the result: 2

I understand the concept o local and global variables, but isn't $GLOBALS
supposed to work as an alternative to "global" statement ? 


--
Best regards,
  Ciprian

> Teamwork is essential. It allows you to blame someone else.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to