3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $buf = ''; report_memory(__LINE__); $buf = implode(range(1,PHP_MAX_INT)); report_memory(__LINE__); example($buf); report_memory(__LINE__); example2($buf); report_memory(__LINE__); function example($str) { report_memory(__LINE__); is_string($str); report_memory(__LINE__); } function example2(& $str) { report_memory(__LINE__); is_string($str); report_memory(__LINE__); } function report_memory($line=0) { echo 'Line: ' . str_pad($line,3) . ' '; echo 'Mem: ' . str_pad(intval(memory_get_usage()/1024 ) . 'K',8) . ' '; echo 'Peak: ' . str_pad(intval(memory_get_peak_usage()/1024) . 'K',8) . ' '; echo "\n"; }
based on ZpUol
Output for 7.2.0
Line: 4 Mem: 377K Peak: 413K Warning: Use of undefined constant PHP_MAX_INT - assumed 'PHP_MAX_INT' (this will throw an Error in a future version of PHP) in /in/idfrq on line 6 Line: 7 Mem: 377K Peak: 413K Line: 16 Mem: 377K Peak: 413K Line: 18 Mem: 377K Peak: 413K Line: 10 Mem: 377K Peak: 413K Line: 22 Mem: 377K Peak: 413K Line: 24 Mem: 377K Peak: 413K Line: 13 Mem: 377K Peak: 413K
Output for 7.0.0 - 7.1.7
Line: 4 Mem: 342K Peak: 377K Notice: Use of undefined constant PHP_MAX_INT - assumed 'PHP_MAX_INT' in /in/idfrq on line 6 Line: 7 Mem: 342K Peak: 377K Line: 16 Mem: 342K Peak: 377K Line: 18 Mem: 342K Peak: 377K Line: 10 Mem: 342K Peak: 377K Line: 22 Mem: 342K Peak: 377K Line: 24 Mem: 342K Peak: 377K Line: 13 Mem: 342K Peak: 377K
Output for 5.4.0 - 5.6.28
Line: 4 Mem: 219K Peak: 224K Notice: Use of undefined constant PHP_MAX_INT - assumed 'PHP_MAX_INT' in /in/idfrq on line 6 Line: 7 Mem: 219K Peak: 224K Line: 16 Mem: 219K Peak: 224K Line: 18 Mem: 219K Peak: 224K Line: 10 Mem: 219K Peak: 224K Line: 22 Mem: 219K Peak: 224K Line: 24 Mem: 219K Peak: 224K Line: 13 Mem: 219K Peak: 224K
Output for 5.3.0 - 5.3.29
Line: 4 Mem: 616K Peak: 625K Notice: Use of undefined constant PHP_MAX_INT - assumed 'PHP_MAX_INT' in /in/idfrq on line 6 Line: 7 Mem: 616K Peak: 625K Line: 16 Mem: 616K Peak: 625K Line: 18 Mem: 616K Peak: 625K Line: 10 Mem: 616K Peak: 625K Line: 22 Mem: 616K Peak: 625K Line: 24 Mem: 616K Peak: 625K Line: 13 Mem: 616K Peak: 625K
Output for 5.2.10 - 5.2.17
Line: 4 Mem: 87K Peak: 94K Notice: Use of undefined constant PHP_MAX_INT - assumed 'PHP_MAX_INT' in /in/idfrq on line 6 Line: 7 Mem: 87K Peak: 94K Line: 16 Mem: 87K Peak: 94K Line: 18 Mem: 87K Peak: 94K Line: 10 Mem: 87K Peak: 94K Line: 22 Mem: 87K Peak: 94K Line: 24 Mem: 87K Peak: 94K Line: 13 Mem: 87K Peak: 94K
Output for 5.2.7 - 5.2.9
Line: 4 Mem: 87K Peak: 94K Notice: Use of undefined constant PHP_MAX_INT - assumed 'PHP_MAX_INT' in /in/idfrq on line 6 Line: 7 Mem: 88K Peak: 94K Line: 16 Mem: 88K Peak: 94K Line: 18 Mem: 88K Peak: 94K Line: 10 Mem: 88K Peak: 94K Line: 22 Mem: 88K Peak: 94K Line: 24 Mem: 88K Peak: 94K Line: 13 Mem: 88K Peak: 94K
Output for 5.2.3 - 5.2.6
Line: 4 Mem: 88K Peak: 95K Notice: Use of undefined constant PHP_MAX_INT - assumed 'PHP_MAX_INT' in /in/idfrq on line 6 Line: 7 Mem: 88K Peak: 95K Line: 16 Mem: 88K Peak: 95K Line: 18 Mem: 88K Peak: 95K Line: 10 Mem: 88K Peak: 95K Line: 22 Mem: 88K Peak: 95K Line: 24 Mem: 88K Peak: 95K Line: 13 Mem: 88K Peak: 95K
Output for 5.2.1 - 5.2.2
Line: 4 Mem: 86K Peak: 92K Notice: Use of undefined constant PHP_MAX_INT - assumed 'PHP_MAX_INT' in /in/idfrq on line 6 Line: 7 Mem: 86K Peak: 92K Line: 16 Mem: 86K Peak: 92K Line: 18 Mem: 86K Peak: 92K Line: 10 Mem: 86K Peak: 92K Line: 22 Mem: 86K Peak: 92K Line: 24 Mem: 86K Peak: 92K Line: 13 Mem: 86K Peak: 92K
Output for 5.0.0 - 5.2.0
Line: 4 Fatal error: Call to undefined function memory_get_usage() in /in/idfrq on line 29
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Line: 4 Fatal error: Call to undefined function: memory_get_usage() in /in/idfrq on line 29
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Line: 4 Fatal error: Call to undefined function: memory_get_usage() in /in/idfrq on line 29
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Line: 4 Fatal error: Call to undefined function: memory_get_usage() in /in/idfrq on line 29