3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public $bar = 1; public $baz = 2; public $qux = 3; } $a = []; for ($i = 0; $i < 1000; $i++) { $a[] = new Foo(); } var_dump(memory_get_usage()); foreach ($a as $o) { foreach ($o as $p) {} } var_dump(memory_get_usage());
Output for 8.1rc1 - rc3
int(521632) int(897664)
Output for 8.0.0 - 8.0.13
int(521040) int(897072)
Output for 7.4.0 - 7.4.26
int(521344) int(897376)
Output for 7.3.0 - 7.3.33
int(521304) int(897336)

preferences:
36.13 ms | 463 KiB | 5 Q