3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php gc_enable(); var_dump(number_format(memory_get_usage(), 0, ',', '.')) . "\n"; var_dump(number_format(memory_get_usage(true), 0,',','.')) . "\n"; class x { private $value; public function __construct($value) { $this->value = $value; } } $array = array(); for($i = 0; $i < 50000; $i++) { $array[] = md5('Hallo'); } $x = new x($array); var_dump(number_format(memory_get_usage(), 0, ',', '.')) . "\n"; var_dump(number_format(memory_get_usage(true), 0,',','.')) . "\n"; unset($array); unset($x); var_dump(number_format(memory_get_usage(), 0, ',', '.')) . "\n"; var_dump(number_format(memory_get_usage(true), 0,',','.')) . "\n";
based on dvnXv
Output for 7.1.0
string(7) "352.840" string(9) "2.097.152" string(9) "5.654.256" string(9) "6.295.552" string(7) "352.872" string(9) "4.194.304"
Output for 7.0.0 - 7.0.14
string(7) "352.888" string(9) "2.097.152" string(9) "5.654.304" string(9) "6.295.552" string(7) "352.920" string(9) "4.194.304"
Output for 5.6.7 - 5.6.28
string(7) "226.040" string(7) "262.144" string(10) "10.351.080" string(10) "10.747.904" string(7) "226.256" string(7) "786.432"
Output for 5.5.24 - 5.5.35
string(7) "226.032" string(7) "262.144" string(10) "10.351.064" string(10) "10.747.904" string(7) "226.232" string(7) "786.432"
Output for 5.4.10 - 5.4.45
string(7) "226.544" string(7) "262.144" string(10) "10.351.552" string(10) "10.747.904" string(7) "226.744" string(7) "786.432"
Output for 5.4.0 - 5.4.9
string(7) "226.544" string(7) "262.144" string(10) "10.351.576" string(10) "10.747.904" string(7) "226.744" string(7) "786.432"
Output for 5.3.11 - 5.3.29
string(7) "632.840" string(7) "786.432" string(10) "10.758.072" string(10) "11.272.192" string(7) "633.016" string(9) "1.310.720"
Output for 5.3.0 - 5.3.10
string(7) "632.704" string(7) "786.432" string(10) "10.757.936" string(10) "11.272.192" string(7) "632.880" string(9) "1.310.720"
Output for 5.0.0 - 5.2.17
Fatal error: Call to undefined function gc_enable() in /in/2RCZf on line 2
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/2RCZf on line 8
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/2RCZf on line 8
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/2RCZf on line 8
Process exited with code 255.