3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { protected $objects; public function __construct() { $this->objects = new \SplObjectStorage; } public function getObjectState($object) { return $this->objects[$object]; } public function attach($object, $state = 1) { $this->objects->attach($object, $state); } } class Object { } class Object2 { } $test = new Test(); $object = new Object(); $object2 = new Object2(); $test->attach($object, 2); print_r($test->getObjectState($object)); print_r($test->getObjectState($object2));

This is an error 404

There are `0` results


preferences:
162.36 ms | 1398 KiB | 7 Q