3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Array to be sorted $array = array('a' => 4, 'b' => 8, 'c' => -1, 'd' => -9, 'e' => 2, 'f' => 5, 'g' => 3, 'h' => -4); print_r($array); // Sort and print the resulting array uasort($array, function($a, $b) { if( $a == $b) return 1; if( $a > $b ) retur -1; return 0; }); print_r($array);
Output for 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Array ( [a] => 4 [b] => 8 [c] => -1 [d] => -9 [e] => 2 [f] => 5 [g] => 3 [h] => -4 ) Fatal error: Uncaught Error: Undefined constant "retur" in /in/QCrmn:10 Stack trace: #0 [internal function]: {closure}(8, -1) #1 /in/QCrmn(8): uasort(Array, Object(Closure)) #2 {main} thrown in /in/QCrmn on line 10
Process exited with code 255.
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28
Array ( [a] => 4 [b] => 8 [c] => -1 [d] => -9 [e] => 2 [f] => 5 [g] => 3 [h] => -4 ) Fatal error: Uncaught Error: Undefined constant "retur" in /in/QCrmn:10 Stack trace: #0 [internal function]: {closure}(8, -1) #1 /in/QCrmn(12): uasort(Array, Object(Closure)) #2 {main} thrown in /in/QCrmn on line 10
Process exited with code 255.
Output for 7.2.6 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33
Array ( [a] => 4 [b] => 8 [c] => -1 [d] => -9 [e] => 2 [f] => 5 [g] => 3 [h] => -4 ) Warning: Use of undefined constant retur - assumed 'retur' (this will throw an Error in a future version of PHP) in /in/QCrmn on line 10 Warning: A non-numeric value encountered in /in/QCrmn on line 10 Warning: Use of undefined constant retur - assumed 'retur' (this will throw an Error in a future version of PHP) in /in/QCrmn on line 10 Warning: A non-numeric value encountered in /in/QCrmn on line 10 Warning: Use of undefined constant retur - assumed 'retur' (this will throw an Error in a future version of PHP) in /in/QCrmn on line 10 Warning: A non-numeric value encountered in /in/QCrmn on line 10 Warning: Use of undefined constant retur - assumed 'retur' (this will throw an Error in a future version of PHP) in /in/QCrmn on line 10 Warning: A non-numeric value encountered in /in/QCrmn on line 10 Array ( [a] => 4 [b] => 8 [c] => -1 [d] => -9 [e] => 2 [f] => 5 [g] => 3 [h] => -4 )
Output for 7.1.0 - 7.1.20
Array ( [a] => 4 [b] => 8 [c] => -1 [d] => -9 [e] => 2 [f] => 5 [g] => 3 [h] => -4 ) Notice: Use of undefined constant retur - assumed 'retur' in /in/QCrmn on line 10 Warning: A non-numeric value encountered in /in/QCrmn on line 10 Notice: Use of undefined constant retur - assumed 'retur' in /in/QCrmn on line 10 Warning: A non-numeric value encountered in /in/QCrmn on line 10 Notice: Use of undefined constant retur - assumed 'retur' in /in/QCrmn on line 10 Warning: A non-numeric value encountered in /in/QCrmn on line 10 Notice: Use of undefined constant retur - assumed 'retur' in /in/QCrmn on line 10 Warning: A non-numeric value encountered in /in/QCrmn on line 10 Array ( [a] => 4 [b] => 8 [c] => -1 [d] => -9 [e] => 2 [f] => 5 [g] => 3 [h] => -4 )
Output for 7.0.0 - 7.0.20
Array ( [a] => 4 [b] => 8 [c] => -1 [d] => -9 [e] => 2 [f] => 5 [g] => 3 [h] => -4 ) Notice: Use of undefined constant retur - assumed 'retur' in /in/QCrmn on line 10 Notice: Use of undefined constant retur - assumed 'retur' in /in/QCrmn on line 10 Notice: Use of undefined constant retur - assumed 'retur' in /in/QCrmn on line 10 Notice: Use of undefined constant retur - assumed 'retur' in /in/QCrmn on line 10 Array ( [a] => 4 [b] => 8 [c] => -1 [d] => -9 [e] => 2 [f] => 5 [g] => 3 [h] => -4 )
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
Array ( [a] => 4 [b] => 8 [c] => -1 [d] => -9 [e] => 2 [f] => 5 [g] => 3 [h] => -4 ) Notice: Use of undefined constant retur - assumed 'retur' in /in/QCrmn on line 10 Notice: Use of undefined constant retur - assumed 'retur' in /in/QCrmn on line 10 Notice: Use of undefined constant retur - assumed 'retur' in /in/QCrmn on line 10 Notice: Use of undefined constant retur - assumed 'retur' in /in/QCrmn on line 10 Notice: Use of undefined constant retur - assumed 'retur' in /in/QCrmn on line 10 Notice: Use of undefined constant retur - assumed 'retur' in /in/QCrmn on line 10 Notice: Use of undefined constant retur - assumed 'retur' in /in/QCrmn on line 10 Notice: Use of undefined constant retur - assumed 'retur' in /in/QCrmn on line 10 Array ( [f] => 5 [g] => 3 [h] => -4 [e] => 2 [d] => -9 [b] => 8 [c] => -1 [a] => 4 )

preferences:
131.62 ms | 404 KiB | 180 Q