note 106626 added to reserved.variables.globals

From: Date: Wed, 23 Nov 2011 06:56:04 +0000
Subject: note 106626 added to reserved.variables.globals
Groups: php.notes 
Request: Send a blank email to php-notes+get-184631@lists.php.net to get a copy of this message
I want to know difference between global and $_GLOBAL example: <?php function test() { $foo = "local variable"; echo '$foo in global scope: ' . $GLOBALS["foo"] . "\n"; echo '$foo in current scope: ' . $foo . "\n"; } $foo = "Example content"; test(); ?> if we change this example to: <?php function test() { global $foo = "local variable"; echo '$foo in global scope: ' . $GLOBALS["foo"] . "\n"; echo '$foo in current scope: ' . $foo . "\n"; } $foo = "Example content"; test(); ?> then what the logical difference... Rohan ---- Server IP: 69.147.83.197 Probable Submitter: 111.118.246.67 ---- Manual Page -- http://www.php.net/manual/en/reserved.variables.globals.php Edit -- https://master.php.net/note/edit/106626 Del: integrated -- https://master.php.net/note/delete/106626/integrated Del: useless -- https://master.php.net/note/delete/106626/useless Del: bad code -- https://master.php.net/note/delete/106626/bad+code Del: spam -- https://master.php.net/note/delete/106626/spam Del: non-english -- https://master.php.net/note/delete/106626/non-english Del: in docs -- https://master.php.net/note/delete/106626/in+docs Del: other reasons-- https://master.php.net/note/delete/106626 Reject -- https://master.php.net/note/reject/106626 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#184631) next »