3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class x { public $value; public $y; public function __construct($value) { $this->value = $value; $this->y = new y(); } } class y { } $array = array(); for($i = 0; $i < 50000; $i++) { $array[] = new x(md5('Hallo')); } var_dump(number_format(memory_get_usage(), 0, ',', '.')) . "\n"; var_dump(number_format(memory_get_usage(true), 0,',','.')) . "\n"; unset($array); var_dump(number_format(memory_get_usage(), 0, ',', '.')) . "\n"; var_dump(number_format(memory_get_usage(true), 0,',','.')) . "\n";
based on YEZQA
Output for 7.1.0
string(10) "12.692.464" string(10) "14.684.160" string(9) "1.391.168" string(10) "12.582.912"
Output for 7.0.0 - 7.0.14
string(10) "12.692.512" string(10) "14.684.160" string(9) "1.391.216" string(10) "12.582.912"
Output for hhvm-3.12.0
string(10) "10.485.760" string(9) "8.559.080" string(10) "10.485.760" string(7) "311.000"
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.6.7 - 5.6.28
string(10) "29.873.288" string(10) "30.408.704" string(9) "8.548.448" string(10) "15.204.352"
Output for 5.5.24 - 5.5.35
string(10) "29.873.224" string(10) "30.408.704" string(9) "8.548.416" string(10) "15.728.640"
Output for 5.4.10 - 5.4.45
string(10) "29.873.776" string(10) "30.408.704" string(9) "8.548.920" string(10) "15.728.640"
Output for 5.4.0 - 5.4.9
string(10) "29.873.776" string(10) "30.408.704" string(9) "8.548.912" string(10) "15.728.640"
Output for 5.3.11 - 5.3.29
string(10) "54.279.872" string(10) "55.050.240" string(9) "8.954.864" string(10) "10.223.616"
Output for 5.3.0 - 5.3.10
string(10) "54.279.464" string(10) "55.050.240" string(9) "8.954.560" string(10) "10.485.760"
Output for 5.2.10 - 5.2.17
string(10) "50.456.648" string(10) "51.118.080" string(9) "6.332.000" string(10) "14.155.776"
Output for 5.2.7 - 5.2.9
string(10) "50.460.128" string(10) "51.118.080" string(9) "6.463.144" string(10) "13.893.632"
Output for 5.2.6
string(10) "50.460.696" string(10) "51.118.080" string(9) "6.463.464" string(10) "13.893.632"
Output for 5.2.3 - 5.2.5
string(10) "50.460.320" string(10) "50.593.792" string(9) "6.463.432" string(10) "12.320.768"
Output for 5.2.2
string(10) "50.458.024" string(10) "50.593.792" string(9) "6.461.336" string(10) "13.107.200"
Output for 5.2.1
string(10) "50.457.976" string(10) "50.593.792" string(9) "6.363.040" string(10) "14.942.208"
Output for 5.0.0 - 5.2.0
Fatal error: Call to undefined function memory_get_usage() in /in/HHAC5 on line 22
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/HHAC5 on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/HHAC5 on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/HHAC5 on line 4
Process exited with code 255.