3v4l.org

run code in 300+ PHP versions simultaneously
<?php function agefilter($item) { return ($item['age'] == 21); } $a = array(); for ($i = 0; $i < 200000; $i++) { $a[] = array( 'name' => 'John', 'city' => 'New York', 'age' => $i % 200 == 0 ? 21 : 28 ); } $time = microtime(true); $filtered = array_filter($a, 'agefilter'); $time = microtime(true) - $time; echo 'callback took ' . number_format($time, 3) . ' seconds and returned ' . count($filtered) . " entries\n";
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.7, 7.2.0
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 20480 bytes) in /in/LPKkJ on line 10
Process exited with code 255.
Output for 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/LPKkJ on line 14
Process exited with code 255.
Output for 5.4.0 - 5.4.45
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 72 bytes) in /in/LPKkJ on line 14
Process exited with code 255.
Output for 5.3.11 - 5.3.29
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 5 bytes) in /in/LPKkJ on line 13
Process exited with code 255.
Output for 5.2.2, 5.3.0 - 5.3.10
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 76 bytes) in /in/LPKkJ on line 14
Process exited with code 255.
Output for 5.2.7 - 5.2.17
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 24 bytes) in /in/LPKkJ on line 13
Process exited with code 255.
Output for 5.2.3 - 5.2.6
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 75 bytes) in /in/LPKkJ on line 16
Process exited with code 255.
Output for 5.2.1
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 64 bytes) in /in/LPKkJ on line 13
Process exited with code 255.
Output for 5.2.0
callback took 0.044 seconds and returned 1000 entries
Output for 5.1.6
callback took 0.050 seconds and returned 1000 entries
Output for 5.1.5
callback took 0.049 seconds and returned 1000 entries
Output for 5.1.4
callback took 0.055 seconds and returned 1000 entries
Output for 5.1.3
callback took 0.048 seconds and returned 1000 entries
Output for 5.1.2
callback took 0.054 seconds and returned 1000 entries
Output for 5.1.1
callback took 0.061 seconds and returned 1000 entries
Output for 5.1.0
callback took 0.064 seconds and returned 1000 entries
Output for 5.0.5
callback took 0.069 seconds and returned 1000 entries
Output for 5.0.1, 5.0.3 - 5.0.4
callback took 0.066 seconds and returned 1000 entries
Output for 5.0.2
callback took 0.088 seconds and returned 1000 entries
Output for 5.0.0
callback took 0.082 seconds and returned 1000 entries
Output for 4.4.9
callback took 0.086 seconds and returned 1000 entries
Output for 4.4.8
callback took 0.090 seconds and returned 1000 entries
Output for 4.3.8, 4.4.7
callback took 0.084 seconds and returned 1000 entries
Output for 4.4.6
callback took 0.079 seconds and returned 1000 entries
Output for 4.3.1, 4.4.5
callback took 0.070 seconds and returned 1000 entries
Output for 4.3.2, 4.4.4
callback took 0.078 seconds and returned 1000 entries
Output for 4.4.3
callback took 0.093 seconds and returned 1000 entries
Output for 4.4.1 - 4.4.2
callback took 0.077 seconds and returned 1000 entries
Output for 4.4.0
callback took 0.059 seconds and returned 1000 entries
Output for 4.3.7, 4.3.11
callback took 0.076 seconds and returned 1000 entries
Output for 4.3.10
callback took 0.068 seconds and returned 1000 entries
Output for 4.3.9
callback took 0.075 seconds and returned 1000 entries
Output for 4.3.6
callback took 0.073 seconds and returned 1000 entries
Output for 4.3.5
callback took 0.091 seconds and returned 1000 entries
Output for 4.3.4
callback took 0.087 seconds and returned 1000 entries
Output for 4.3.3
callback took 0.074 seconds and returned 1000 entries
Output for 4.3.0
callback took 0.115 seconds and returned 1000 entries

preferences:
154.54 ms | 401 KiB | 216 Q