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); while(gc_collect_cycles() == 0) { } 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.440" string(9) "6.295.552"
Process exited with code 137.
Output for 7.1.0, 7.1.7
string(9) "5.652.968" string(9) "6.295.552"
Process exited with code 137.
Output for 7.1.5 - 7.1.6
string(9) "5.653.960" string(9) "6.295.552"
Process exited with code 137.
Output for 7.0.0 - 7.0.20
string(9) "5.653.032" string(9) "6.295.552"
Process exited with code 137.
Output for 5.6.7 - 5.6.28
string(10) "10.349.720" string(10) "10.747.904"
Process exited with code 137.
Output for 5.5.24 - 5.5.35
string(10) "10.349.712" string(10) "10.747.904"
Process exited with code 137.
Output for 5.4.0 - 5.4.45
string(10) "10.350.200" string(10) "10.747.904"
Process exited with code 137.

preferences:
90.62 ms | 401 KiB | 92 Q