3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function cmp($b, $c){ global $a; var_dump($a); $a->exchangeArray(array()); } $a = new ArrayObject(); $a[1] = 1; $a[2] = 2; $a[3] = 3; $a->uasort(cmp);
based on 0VGGt
Output for 7.2.0
Warning: Use of undefined constant cmp - assumed 'cmp' (this will throw an Error in a future version of PHP) in /in/tnfhe on line 14 object(ArrayObject)#1 (1) { ["storage":"ArrayObject":private]=> array(3) { [1]=> int(1) [2]=> int(2) [3]=> int(3) } } Warning: Modification of ArrayObject during sorting is prohibited in /in/tnfhe on line 6 object(ArrayObject)#1 (1) { ["storage":"ArrayObject":private]=> array(3) { [1]=> int(1) [2]=> int(2) [3]=> int(3) } } Warning: Modification of ArrayObject during sorting is prohibited in /in/tnfhe on line 6
Output for 7.0.6 - 7.1.10
Notice: Use of undefined constant cmp - assumed 'cmp' in /in/tnfhe on line 14 object(ArrayObject)#1 (1) { ["storage":"ArrayObject":private]=> array(3) { [1]=> int(1) [2]=> int(2) [3]=> int(3) } } Warning: Modification of ArrayObject during sorting is prohibited in /in/tnfhe on line 6 object(ArrayObject)#1 (1) { ["storage":"ArrayObject":private]=> array(3) { [1]=> int(1) [2]=> int(2) [3]=> int(3) } } Warning: Modification of ArrayObject during sorting is prohibited in /in/tnfhe on line 6
Output for 7.0.5
Notice: Use of undefined constant cmp - assumed 'cmp' in /in/tnfhe on line 14 object(ArrayObject)#1 (1) { ["storage":"ArrayObject":private]=> array(3) { [1]=> int(1) [2]=> int(2) [3]=> int(3) [3]=> int(3) } } Warning: Modification of ArrayObject during sorting is prohibited in /in/tnfhe on line 6 object(ArrayObject)#1 (1) { ["storage":"ArrayObject":private]=> array(3) { [1]=> int(1) [2]=> int(2) [3]=> int(3) [3]=> int(3) } } Warning: Modification of ArrayObject during sorting is prohibited in /in/tnfhe on line 6
Output for 7.0.0 - 7.0.4
Notice: Use of undefined constant cmp - assumed 'cmp' in /in/tnfhe on line 14 object(ArrayObject)#1 (1) { ["storage":"ArrayObject":private]=> *RECURSION* } object(ArrayObject)#1 (1) { ["storage":"ArrayObject":private]=> array(0) { } }
Output for 5.3.21 - 5.6.21
Notice: Use of undefined constant cmp - assumed 'cmp' in /in/tnfhe on line 14 object(ArrayObject)#1 (1) { ["storage":"ArrayObject":private]=> *RECURSION* } object(ArrayObject)#1 (1) { ["storage":"ArrayObject":private]=> array(0) { } }
Process exited with code 139.