3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array(); for ($i = 0; $i < 100000; $i++) { $arr[] = array("foo" => $i, "bar" => $i); } print(memory_get_peak_usage() . "\r\n"); $arr_chunked = array_chunk($arr, 100); print(memory_get_peak_usage() . "\r\n");
Output for 8.2.18, 8.3.5 - 8.3.7
40089064 42725632
Output for 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Fatal error: Out of memory (allocated 31461376 bytes) (tried to allocate 20480 bytes) in /in/XWX9R on line 4 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.
Output for 8.1.0 - 8.1.1, 8.1.28
42186528 50471480
Output for 8.1.2 - 8.1.27
Fatal error: Out of memory (allocated 29364224) (tried to allocate 4194312 bytes) in /in/XWX9R on line 4 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.
Output for 8.0.0 - 8.0.30
42185936 50470888
Output for 7.4.0 - 7.4.33
42186240 50471192
Output for 7.3.0 - 7.3.33
42186160 50471112
Output for 7.2.17 - 7.2.33
42182400 50467352
Output for 7.2.0 - 7.2.6
42182440 50467392
Output for 7.1.26 - 7.1.33
42145696 50430648
Output for 7.0.0 - 7.0.20, 7.1.0, 7.1.7 - 7.1.20
42145768 50430720
Output for 7.1.5 - 7.1.6
42145936 50430888
Output for 5.6.8 - 5.6.28
54069112 64142008
Output for 5.5.24 - 5.5.35
54069112 64141960

preferences:
190.5 ms | 401 KiB | 213 Q