3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $arr1 = [1,2,3]; $arr2 = $arr1; debug_zval_dump('arr2'); key($arr2); debug_zval_dump('arr2'); unset($arr1); unset($arr2); $arr1 = [1,2,3]; $arr2 = $arr1; debug_zval_dump('arr2'); end($arr2); debug_zval_dump('arr2');
based on lGirX
Output for 5.4.0 - 7.1.0, 7.1.7 - 7.2.0
string(4) "arr2" refcount(1) string(4) "arr2" refcount(1) string(4) "arr2" refcount(1) string(4) "arr2" refcount(1)
Output for 7.1.5 - 7.1.6
string(4) "arr2" refcount(2) string(4) "arr2" refcount(2) string(4) "arr2" refcount(2) string(4) "arr2" refcount(2)
Output for 5.3.19 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/uV3sl on line 2
Process exited with code 255.