[PHP] Strange PHP Reference behaviour with globals

2001-03-16 Thread John
Hello, Try the following code: ?php $gGlobal = 1; function ChangeGlobalValue() { global $gGlobal; $local = 55; $gGlobal = $local; print "Value:Global=$gGlobalBR"; } function ChangeGlobalRef() { global $gGlobal; $local = 99; $gGlobal = $local; print "Ref:Global=$gGlobalBR"; } print

Re: [PHP] Strange PHP Reference behaviour with globals

2001-03-16 Thread Yasuo Ohgaki
This is expected behavior of PHP's reference. Reference works like a pointer, but it dose NOT works like a pointer. This is case that reference does not works as many programmer expected. I think this is in manual. Hint: when programmer use 'global $var'. It is the same as do '$var =

Re: [PHP] Strange PHP Reference behaviour with globals

2001-03-16 Thread John
Thanks Yasuo, That might explain why $gGlobal is not permanently set to 99, but that doesn't explain why $gGlobal is set to 55 in ChangeGlobalValue() permanently. So are you or am I missing something? Bye, John ""Yasuo Ohgaki"" [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL

Re: [PHP] Strange PHP Reference behaviour with globals

2001-03-16 Thread Yasuo Ohgaki
- Original Message - From: "John" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, March 16, 2001 9:12 PM Subject: Re: [PHP] Strange PHP Reference behaviour with globals Thanks Yasuo, That might explain why $gGlobal is not permanently set to 99, but that doesn't e