- var_dump: documentation ( source)
<?php
// Testing Globals
$GLOBALS['A'] = 'B';
$arrayCopyGlobalsVar = $GLOBALS;
$arrayCopyGlobalsVar['A'] = 'C';
var_dump([
'$GLOBALS' => $GLOBALS['A'],
'$arrayCopyGlobalsVar' => $arrayCopyGlobalsVar['A'],
]);
$GLOBALS['A'] = 'B';
$nonReferencedGlobalsVar = new ArrayObject($GLOBALS);
$nonReferencedGlobalsVar = $nonReferencedGlobalsVar->getArrayCopy();
$nonReferencedGlobalsVar['A'] = 'D';
var_dump([
'$GLOBALS' => $GLOBALS['A'],
'$nonReferencedGlobalsVar' => $nonReferencedGlobalsVar['A']
]);