3v4l.org

run code in 300+ PHP versions simultaneously
<?php gc_enable(); 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";
Output for 7.4.0 - 7.4.1
string(10) "12.733.032" string(10) "14.684.160" string(9) "1.431.736" string(10) "12.582.912"
Output for 7.3.0 - 7.3.13
string(10) "12.733.040" string(10) "14.684.160" string(9) "1.431.744" string(10) "12.582.912"
Output for 7.2.0 - 7.2.26
string(10) "12.729.328" string(10) "14.684.160" string(9) "1.428.032" string(10) "12.582.912"
Output for 7.1.0 - 7.1.33
string(10) "12.692.856" string(10) "14.684.160" string(9) "1.391.560" string(10) "12.582.912"
Output for 7.0.0 - 7.0.33
string(10) "12.692.904" string(10) "14.684.160" string(9) "1.391.608" string(10) "12.582.912"
Output for 5.6.0 - 5.6.40
string(10) "29.873.456" string(10) "30.408.704" string(9) "8.548.672" string(10) "16.777.216"
Output for 5.5.0 - 5.5.38
string(10) "29.873.456" string(10) "30.408.704" string(9) "8.548.640" string(10) "16.777.216"
Output for 5.4.10 - 5.4.45
string(10) "29.873.936" string(10) "30.408.704" string(9) "8.549.128" string(10) "16.777.216"
Output for 5.4.0 - 5.4.9
string(10) "29.873.936" string(10) "30.408.704" string(9) "8.549.136" string(10) "16.777.216"
Output for 5.3.11 - 5.3.29
string(10) "54.279.528" string(10) "55.050.240" string(9) "8.954.608" string(10) "11.010.048"
Output for 5.3.0 - 5.3.10
string(10) "54.279.328" string(10) "55.050.240" string(9) "8.954.472" string(10) "10.747.904"
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
Fatal error: Call to undefined function gc_enable() in /in/HZpia 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/HZpia on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/HZpia on line 5
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/HZpia on line 5
Process exited with code 255.

preferences:
209.7 ms | 401 KiB | 325 Q