1--TEST-- 2Supported operations on $GLOBALS 3--FILE-- 4<?php 5 6function test() { 7 var_dump($GLOBALS['x']); 8 $GLOBALS['x'] = 1; 9 var_dump($GLOBALS['x']); 10 $GLOBALS['x']++; 11 var_dump($GLOBALS['x']); 12 $GLOBALS['x'] += 2; 13 var_dump($GLOBALS['x']); 14 unset($GLOBALS['y']); 15 var_dump(isset($GLOBALS['x'])); 16 var_dump(isset($GLOBALS['y'])); 17 $GLOBALS['z'][] = 1; 18} 19 20$y = 1; 21test(); 22var_dump($x, $y, $z); 23 24$ref = 1; 25$GLOBALS['z'] =& $ref; 26$ref++; 27var_dump($z); 28 29$x = 1; 30$ref2 =& $GLOBALS['x']; 31$ref2++; 32var_dump($x); 33 34?> 35--EXPECTF-- 36Warning: Undefined global variable $x in %s on line %d 37NULL 38int(1) 39int(2) 40int(4) 41bool(true) 42bool(false) 43 44Warning: Undefined variable $y in %s on line %d 45int(4) 46NULL 47array(1) { 48 [0]=> 49 int(1) 50} 51int(2) 52int(2) 53