3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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();
based on SLFBj
Output for 7.0.0 - 7.2.0
object(A)#2 (0) refcount(3){ } object(B)#3 (0) refcount(2){ }
Output for 5.3.19 - 5.6.28
object(A)#2 (0) refcount(1){ } object(B)#3 (0) refcount(1){ }