3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $splstack = new \SplStack(); $splstack->push(10); $splstack->push(11); $splstack->push(12); $splstack->push(13); $splstack->push(14); $val1 = $this->splstack->pop(); $val2 = $this->splstack->pop(); var_dump($val1, $val2);
Output for 7.0.0 - 7.3.0rc3
Fatal error: Uncaught Error: Using $this when not in object context in /in/9IM8X:10 Stack trace: #0 {main} thrown in /in/9IM8X on line 10
Process exited with code 255.
Output for 5.3.0 - 5.6.28
Fatal error: Using $this when not in object context in /in/9IM8X on line 10
Process exited with code 255.
Output for 5.0.0 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/9IM8X on line 3 Fatal error: Class 'SplStack' not found in /in/9IM8X on line 3
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/9IM8X on line 3 Fatal error: Cannot instantiate non-existent class: splstack in /in/9IM8X on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/9IM8X on line 3 Fatal error: Cannot instantiate non-existent class: splstack in /in/9IM8X on line 3