3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $arr1 = [ "2179454040" => "127.0.0.1:6379", "2159827012" => "127.0.0.1:6380", "2171050562" => "127.0.0.1:6380", "2153052555" => "127.0.0.1:6381", "2171236323" => "127.0.0.1:6381", "2162841922" => "127.0.0.1:6381", "2173346807" => "127.0.0.1:6382", "2171411418" => "127.0.0.1:6382", "2151534559" => "127.0.0.1:6382" ]; for ($i = 0; $i < count($arr1); $i++) { ksort(arr1[$i], SORT_NUMERIC); } var_dump($arr1);
Output for 5.6.7 - 5.6.28
Notice: Use of undefined constant arr1 - assumed 'arr1' in /in/SQTJ7 on line 17 Warning: ksort() expects parameter 1 to be array, string given in /in/SQTJ7 on line 17 Notice: Use of undefined constant arr1 - assumed 'arr1' in /in/SQTJ7 on line 17 Warning: ksort() expects parameter 1 to be array, string given in /in/SQTJ7 on line 17 Notice: Use of undefined constant arr1 - assumed 'arr1' in /in/SQTJ7 on line 17 Warning: ksort() expects parameter 1 to be array, string given in /in/SQTJ7 on line 17 Notice: Use of undefined constant arr1 - assumed 'arr1' in /in/SQTJ7 on line 17 Warning: ksort() expects parameter 1 to be array, string given in /in/SQTJ7 on line 17 Notice: Use of undefined constant arr1 - assumed 'arr1' in /in/SQTJ7 on line 17 Notice: Uninitialized string offset: 4 in /in/SQTJ7 on line 17 Warning: ksort() expects parameter 1 to be array, string given in /in/SQTJ7 on line 17 Notice: Use of undefined constant arr1 - assumed 'arr1' in /in/SQTJ7 on line 17 Notice: Uninitialized string offset: 5 in /in/SQTJ7 on line 17 Warning: ksort() expects parameter 1 to be array, string given in /in/SQTJ7 on line 17 Notice: Use of undefined constant arr1 - assumed 'arr1' in /in/SQTJ7 on line 17 Notice: Uninitialized string offset: 6 in /in/SQTJ7 on line 17 Warning: ksort() expects parameter 1 to be array, string given in /in/SQTJ7 on line 17 Notice: Use of undefined constant arr1 - assumed 'arr1' in /in/SQTJ7 on line 17 Notice: Uninitialized string offset: 7 in /in/SQTJ7 on line 17 Warning: ksort() expects parameter 1 to be array, string given in /in/SQTJ7 on line 17 Notice: Use of undefined constant arr1 - assumed 'arr1' in /in/SQTJ7 on line 17 Notice: Uninitialized string offset: 8 in /in/SQTJ7 on line 17 Warning: ksort() expects parameter 1 to be array, string given in /in/SQTJ7 on line 17 array(9) { [2179454040]=> string(14) "127.0.0.1:6379" [2159827012]=> string(14) "127.0.0.1:6380" [2171050562]=> string(14) "127.0.0.1:6380" [2153052555]=> string(14) "127.0.0.1:6381" [2171236323]=> string(14) "127.0.0.1:6381" [2162841922]=> string(14) "127.0.0.1:6381" [2173346807]=> string(14) "127.0.0.1:6382" [2171411418]=> string(14) "127.0.0.1:6382" [2151534559]=> string(14) "127.0.0.1:6382" }
Output for 5.4.0 - 5.4.25
Parse error: syntax error, unexpected '[' in /in/SQTJ7 on line 17
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected '[' in /in/SQTJ7 on line 4
Process exited with code 255.