3v4l.org

run code in 300+ PHP versions simultaneously
<?php gc_enable(); 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); sleep(4); 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.688.968" string(9) "6.295.552"
Process exited with code 137.
Output for 7.1.0, 7.1.7
string(9) "5.652.496" string(9) "6.295.552"
Process exited with code 137.
Output for 7.1.5 - 7.1.6
string(9) "5.653.472" string(9) "6.295.552"
Process exited with code 137.
Output for 7.0.0 - 7.0.20
string(9) "5.652.544" string(9) "6.295.552"
Process exited with code 137.
Output for 5.6.7 - 5.6.28
string(10) "10.349.560" string(10) "10.747.904"
Process exited with code 137.
Output for 5.5.24 - 5.5.35
string(10) "10.349.568" string(10) "10.747.904"
Process exited with code 137.
Output for 5.4.10 - 5.4.45
string(10) "10.350.120" string(10) "10.747.904"
Process exited with code 137.
Output for 5.4.0 - 5.4.9
string(10) "10.350.096" string(10) "10.747.904"
Process exited with code 137.

preferences:
106.15 ms | 401 KiB | 92 Q