<?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();
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
object(A)#2 (0) refcount(3){
}
object(B)#3 (0) refcount(2){
}