3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = []; readonly class T { public function __construct(public int $x, public int $y) {}} for($x = 0; $x <= 100_000; $x++) $arr[] = new T(1,2); echo "Current memory usage: " . (memory_get_usage() / 1024) . " KB\n"; echo "Peak memory usage: " . (memory_get_peak_usage() / 1024) . " KB\n";

preferences:
29.13 ms | 405 KiB | 5 Q