3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = range(0, 1e6); echo memory_get_peak_usage()/1024 . 'kB' . PHP_EOL; foreach ($array as $i => $a) { (bool)$a; } echo memory_get_peak_usage()/1024 . 'kB';
Output for 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
16766kB 16766.109375kB
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 16766kB 16766.109375kB
Output for 8.1.0 - 8.1.1, 8.1.28
33150.3046875kB 33150.421875kB
Output for 8.1.2 - 8.1.27
Fatal error: Out of memory (allocated 2097152) (tried to allocate 33554440 bytes) in /in/YeJKR on line 3 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
33149.8203125kB 33150.109375kB
Output for 7.4.0 - 7.4.33
33150.1171875kB 33150.40625kB
Output for 7.3.0 - 7.3.33
33150.0390625kB 33150.328125kB
Output for 7.2.0 - 7.2.33
33146.1875kB 33146.4765625kB
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33
33110.4375kB 33110.7265625kB
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 32 bytes) in /in/YeJKR on line 3
Process exited with code 255.

preferences:
315.74 ms | 402 KiB | 376 Q