note 105615 deleted from language.variables.superglobals by danbrown
| From: | danbrown@php.net | Date: | Wed, 31 Aug 2011 23:56:11 +0000 |
| Subject: | note 105615 deleted from language.variables.superglobals by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-182873@lists.php.net to get a copy of this message | ||
Note Submitter: m dot hopf at hyperjoint dot com
----
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"