3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { } class B { } class Cache { protected $store = array(); public function store($object) { $this->store[] = $object; } public function gc() { foreach ($this->store as &$object) { debug_zval_dump($object); } } } $cache = new Cache(); $cache->store($a = new A); $cache->store(new B); $cache->gc();

preferences:
38.6 ms | 402 KiB | 5 Q