3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class x { public $value; public function __construct($value) { $this->value = $value; } } $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 2EBN0
Output for 7.1.0
string(9) "8.967.896" string(10) "10.489.856" string(7) "866.600" string(9) "8.388.608"
Output for 7.0.0 - 7.0.14
string(9) "8.967.944" string(10) "10.489.856" string(7) "866.648" string(9) "8.388.608"
Output for hhvm-3.12.0
string(9) "8.388.608" string(9) "6.557.712" string(9) "8.388.608" string(7) "309.632"
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.6.8 - 5.6.28
string(10) "20.877.600" string(10) "21.495.808" string(9) "4.352.848" string(10) "10.223.616"
Output for 5.5.24 - 5.5.35
string(10) "20.877.600" string(10) "21.495.808" string(9) "4.352.824" string(9) "9.961.472"
Output for 5.4.10 - 5.4.45
string(10) "20.878.128" string(10) "21.495.808" string(9) "4.353.336" string(9) "9.437.184"
Output for 5.4.0 - 5.4.9
string(10) "20.878.112" string(10) "21.495.808" string(9) "4.353.336" string(9) "9.437.184"
Output for 5.3.11 - 5.3.29
string(10) "32.482.992" string(10) "33.030.144" string(9) "4.758.304" string(9) "6.291.456"
Output for 5.3.0 - 5.3.10
string(10) "32.483.008" string(10) "33.030.144" string(9) "4.758.000" string(9) "6.029.312"
Output for 5.2.10 - 5.2.17
string(10) "30.108.936" string(10) "30.670.848" string(9) "3.184.040" string(9) "8.650.752"
Output for 5.2.7 - 5.2.9
string(10) "30.111.872" string(10) "30.670.848" string(9) "3.315.208" string(9) "9.437.184"
Output for 5.2.6
string(10) "30.112.128" string(10) "30.670.848" string(9) "3.315.552" string(9) "9.175.040"
Output for 5.2.3 - 5.2.5
string(10) "30.112.000" string(10) "30.146.560" string(9) "3.315.496" string(9) "8.650.752"
Output for 5.2.2
string(10) "30.109.832" string(10) "30.146.560" string(9) "3.313.416" string(9) "8.650.752"
Output for 5.2.1
string(10) "30.109.208" string(10) "30.146.560" string(9) "3.215.104" string(9) "8.388.608"
Output for 5.0.0 - 5.2.0
Fatal error: Call to undefined function memory_get_usage() in /in/YEZQA on line 16
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/YEZQA 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/YEZQA 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/YEZQA on line 4
Process exited with code 255.