3v4l.org

run code in 300+ PHP versions simultaneously
<?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);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught Error: Undefined constant "cmp" in /in/tnfhe:14 Stack trace: #0 {main} thrown in /in/tnfhe on line 14
Process exited with code 255.
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
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.0.20, 7.1.0 - 7.1.25
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.5.24 - 5.5.35, 5.6.8 - 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.

preferences:
165.96 ms | 402 KiB | 197 Q