3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $o1 = new StdClass; $o2 = new StdClass; $s = new SplObjectStorage(); $s->attach($o1); // similar to $s[$o1] = NULL; $s->attach($o2, "hello"); // similar to $s[$o2] = "hello"; $s->attach($o2, "cc"); foreach ($s as $k => $v) { var_dump($k, $v, $s->getData()); }
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught Error: Call to undefined method SplObjectStorage::getData() in /in/YMjG5:11 Stack trace: #0 {main} thrown in /in/YMjG5 on line 11
Process exited with code 255.
Output for 5.3.0 - 5.6.28
Fatal error: Call to undefined method SplObjectStorage::getData() in /in/YMjG5 on line 11
Process exited with code 255.
Output for 5.1.0 - 5.2.17
Warning: SplObjectStorage::attach() expects exactly 1 parameter, 2 given in /in/YMjG5 on line 7 Warning: SplObjectStorage::attach() expects exactly 1 parameter, 2 given in /in/YMjG5 on line 8 Fatal error: Call to undefined method SplObjectStorage::getData() in /in/YMjG5 on line 11
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Fatal error: Class 'SplObjectStorage' not found in /in/YMjG5 on line 5
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: splobjectstorage in /in/YMjG5 on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: splobjectstorage in /in/YMjG5 on line 5