3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a=range(1, 500); foreach($a as $k=>$v) { } var_dump(memory_get_peak_usage()); foreach($a as $k=>$v) { $a[$k]++; } var_dump(memory_get_peak_usage());
Output for 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
int(422944) int(422944)
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 int(422944) int(422944)
Output for 8.1.0 - 8.1.28
int(423248) int(428912)
Output for 8.0.0 - 8.0.30
int(423088) int(428416)
Output for 7.4.0 - 7.4.33
int(423520) int(428976)
Output for 7.3.12 - 7.3.33
int(423296) int(428896)
Output for 7.2.29 - 7.2.33
int(418520) int(424888)
Output for 7.2.6
int(418560) int(424928)
Output for 7.1.0, 7.1.7 - 7.1.20
int(381856) int(388320)
Output for 7.1.5 - 7.1.6
int(381856) int(388528)
Output for 7.0.0 - 7.0.20
int(381832) int(388328)
Output for 5.6.7 - 5.6.28
int(292360) int(364760)
Output for 5.4.0 - 5.4.9, 5.5.24 - 5.5.35
int(292360) int(364656)
Output for 5.4.10 - 5.4.45
int(292904) int(365200)
Output for 5.3.11 - 5.3.29
int(696056) int(768392)
Output for 5.3.0 - 5.3.10
int(695752) int(768088)
Output for 5.2.10 - 5.2.17
int(149584) int(217880)
Output for 5.2.7 - 5.2.9
int(149664) int(217960)
Output for 5.2.3 - 5.2.6
int(149984) int(218280)
Output for 5.2.2
int(147904) int(216200)
Output for 5.2.1
int(147392) int(215688)
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0
Fatal error: Call to undefined function memory_get_peak_usage() in /in/A2ssv on line 7
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: memory_get_peak_usage() in /in/A2ssv on line 7
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.4
Fatal error: Call to undefined function: memory_get_peak_usage() in /in/A2ssv on line 7
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: memory_get_peak_usage() in /in/A2ssv on line 7

preferences:
203.98 ms | 401 KiB | 313 Q