3v4l.org

run code in 300+ PHP versions simultaneously
<?php const INT_COUNT = 1000000; // Fill an array with random ints $ints = array(); for ($i = 0; $i < INT_COUNT; $i++){ $ints[] = rand(0, 255); } // Sort the ints sort($ints); $start = microtime(true); // Do nothing but access each int in the array for ($i = 0; $i < INT_COUNT; $i++){ $ints[$i]; } $finish = microtime(true); printf("Time taken with sort(): %.5f seconds\n", $finish - $start); // Now do it again, but this time use an asort // Fill an array with random ints $ints2 = array(); for ($i = 0; $i < INT_COUNT; $i++){ $ints2[] = rand(0, 255); } // asort the ints asort($ints2); $start = microtime(true); // Do nothing but access each int in the array for ($i = 0; $i < INT_COUNT; $i++){ $ints2[$i]; } $finish = microtime(true); printf("Time taken with asort(): %.5f seconds\n", $finish - $start);
Output for 7.3.1
Time taken with sort(): 0.02637 seconds Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 33554440 bytes) in /in/sRQXr on line 31
Process exited with code 255.
Output for 7.3.0
Time taken with sort(): 0.02810 seconds Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 33554440 bytes) in /in/sRQXr on line 31
Process exited with code 255.
Output for 7.2.4, 7.2.6 - 7.2.7, 7.2.12 - 7.2.13

Process exited with code 137.
Output for 7.2.11
Time taken with sort(): 0.02625 seconds Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 33554440 bytes) in /in/sRQXr on line 31
Process exited with code 255.
Output for 7.2.10
Time taken with sort(): 0.02601 seconds Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 33554440 bytes) in /in/sRQXr on line 31
Process exited with code 255.
Output for 7.2.9
Time taken with sort(): 0.02615 seconds Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 33554440 bytes) in /in/sRQXr on line 31
Process exited with code 255.
Output for 7.2.8
Time taken with sort(): 0.02660 seconds Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 33554440 bytes) in /in/sRQXr on line 31
Process exited with code 255.
Output for 7.2.5
Time taken with sort(): 0.02576 seconds Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 33554440 bytes) in /in/sRQXr on line 31
Process exited with code 255.
Output for 7.2.3
Time taken with sort(): 0.02709 seconds Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 33554440 bytes) in /in/sRQXr on line 31
Process exited with code 255.
Output for 7.2.2
Time taken with sort(): 0.02622 seconds Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 33554440 bytes) in /in/sRQXr on line 31
Process exited with code 255.
Output for 7.2.1
Time taken with sort(): 0.02480 seconds Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 33554440 bytes) in /in/sRQXr on line 31
Process exited with code 255.
Output for 7.2.0
Time taken with sort(): 0.02564 seconds Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 33554440 bytes) in /in/sRQXr on line 31
Process exited with code 255.
Output for 7.1.25
Time taken with sort(): 0.05438 seconds Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 33554440 bytes) in /in/sRQXr on line 31
Process exited with code 255.
Output for 7.1.7
Time taken with sort(): 0.01922 seconds Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 33554440 bytes) in /in/sRQXr on line 31
Process exited with code 255.
Output for 7.1.6
Time taken with sort(): 0.01942 seconds Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 33554440 bytes) in /in/sRQXr on line 31
Process exited with code 255.
Output for 7.1.5
Time taken with sort(): 0.01764 seconds Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 33554440 bytes) in /in/sRQXr on line 31
Process exited with code 255.
Output for 7.1.0
Time taken with sort(): 0.01655 seconds Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 33554440 bytes) in /in/sRQXr on line 31
Process exited with code 255.
Output for 7.0.20
Time taken with sort(): 0.02177 seconds Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 33554440 bytes) in /in/sRQXr on line 31
Process exited with code 255.
Output for 7.0.14
Time taken with sort(): -0.01902 seconds Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 33554440 bytes) in /in/sRQXr on line 31
Process exited with code 255.
Output for 7.0.10
Time taken with sort(): 0.02300 seconds Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 33554440 bytes) in /in/sRQXr on line 31
Process exited with code 255.
Output for 7.0.9
Time taken with sort(): 0.01950 seconds Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 33554440 bytes) in /in/sRQXr on line 31
Process exited with code 255.
Output for 7.0.8
Time taken with sort(): 0.01902 seconds Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 33554440 bytes) in /in/sRQXr on line 31
Process exited with code 255.
Output for 7.0.7
Time taken with sort(): 0.01947 seconds Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 33554440 bytes) in /in/sRQXr on line 31
Process exited with code 255.
Output for 7.0.6
Time taken with sort(): 0.01929 seconds Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 33554440 bytes) in /in/sRQXr on line 31
Process exited with code 255.
Output for 7.0.5
Time taken with sort(): 0.02092 seconds Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 33554440 bytes) in /in/sRQXr on line 31
Process exited with code 255.
Output for 7.0.4
Time taken with sort(): 0.01607 seconds Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 33554440 bytes) in /in/sRQXr on line 31
Process exited with code 255.
Output for 7.0.3
Time taken with sort(): 0.01988 seconds Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 33554440 bytes) in /in/sRQXr on line 31
Process exited with code 255.
Output for 7.0.2
Time taken with sort(): 0.01963 seconds Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 33554440 bytes) in /in/sRQXr on line 31
Process exited with code 255.
Output for 7.0.1
Time taken with sort(): 0.02007 seconds Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 33554440 bytes) in /in/sRQXr on line 31
Process exited with code 255.
Output for 7.0.0
Time taken with sort(): 0.01985 seconds Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 33554440 bytes) in /in/sRQXr on line 31
Process exited with code 255.
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 32 bytes) in /in/sRQXr on line 8
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
Parse error: syntax error, unexpected T_CONST in /in/sRQXr on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_CONST in /in/sRQXr on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/sRQXr on line 3
Process exited with code 255.

preferences:
208.57 ms | 401 KiB | 232 Q