3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function foo() { $this->foo = 'foo'; } foo();
Output for 7.0.0 - 7.3.0beta1
Fatal error: Uncaught Error: Using $this when not in object context in /in/2Zt1f:5 Stack trace: #0 /in/2Zt1f(8): foo() #1 {main} thrown in /in/2Zt1f on line 5
Process exited with code 255.
Output for 5.0.0 - 5.6.21
Fatal error: Using $this when not in object context in /in/2Zt1f on line 5
Process exited with code 255.
Output for 4.3.0 - 4.4.9