3v4l.org

run code in 300+ PHP versions simultaneously
<?php gc_enable(); class x { public $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); gc_collect_cycles(); sleep(1); var_dump(number_format(memory_get_usage(), 0, ',', '.')) . "\n"; var_dump(number_format(memory_get_usage(true), 0,',','.')) . "\n";
Output for 7.2.0
string(9) "5.689.472" string(9) "6.295.552" string(7) "388.120" string(9) "4.194.304"
Output for 7.1.0, 7.1.7
string(9) "5.653.000" string(9) "6.295.552" string(7) "351.648" string(9) "4.194.304"
Output for 7.1.5 - 7.1.6
string(9) "5.654.024" string(9) "6.295.552" string(7) "352.672" string(9) "4.194.304"
Output for 7.0.0 - 7.0.20
string(9) "5.653.048" string(9) "6.295.552" string(7) "351.696" string(9) "4.194.304"
Output for 5.6.0 - 5.6.26
string(10) "10.349.704" string(10) "10.747.904" string(7) "224.904" string(7) "786.432"
Output for 5.5.0 - 5.5.38
string(10) "10.349.696" string(10) "10.747.904" string(7) "224.880" string(7) "786.432"
Output for 5.4.0 - 5.4.45
string(10) "10.350.168" string(10) "10.747.904" string(7) "225.392" string(7) "786.432"
Output for 5.3.11 - 5.3.29
string(10) "10.755.584" string(10) "11.272.192" string(7) "630.528" string(9) "1.572.864"
Output for 5.3.0 - 5.3.10
string(10) "10.755.384" string(10) "11.272.192" string(7) "630.392" string(9) "1.310.720"
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/sgAN3 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/sgAN3 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/sgAN3 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/sgAN3 on line 5
Process exited with code 255.

preferences:
147.36 ms | 401 KiB | 217 Q