note 105615 added to language.variables.superglobals

From: Date: Wed, 31 Aug 2011 23:39:50 +0000
Subject: note 105615 added to language.variables.superglobals
Groups: php.notes 
Request: Send a blank email to php-notes+get-182872@lists.php.net to get a copy of this message
strange differing Behaviour of array_merge and adding arrays with Superglobal $GLOBALS: $test_arr=array('test'=>'hallo'); //merge $test_arr into $GLOBALS (doesn't work) $GLOBALS=array_merge($GLOBALS, $test_arr); global $test; var_dump($GLOBALS['test']); echo '<br>'; var_dump($test); results in string(5) "hallo" NULL while //add $test_arr to $GLOBALS (works) $GLOBALS=$GLOBALS+$test_arr; global $test; var_dump($GLOBALS['test']); echo '<br>'; var_dump($test); results in string(5) "hallo" string(5) "hallo" ---- Server IP: 69.147.83.197 Probable Submitter: 84.189.180.248 ---- Manual Page -- http://www.php.net/manual/en/language.variables.superglobals.php Edit -- https://master.php.net/note/edit/105615 Del: integrated -- https://master.php.net/note/delete/105615/integrated Del: useless -- https://master.php.net/note/delete/105615/useless Del: bad code -- https://master.php.net/note/delete/105615/bad+code Del: spam -- https://master.php.net/note/delete/105615/spam Del: non-english -- https://master.php.net/note/delete/105615/non-english Del: in docs -- https://master.php.net/note/delete/105615/in+docs Del: other reasons-- https://master.php.net/note/delete/105615 Reject -- https://master.php.net/note/reject/105615 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#182872) next »