3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class a { public $t = 3; public function call($fun) { $b = $fun($p); } } class b { public $t = 5; public function test() { $p = 2; a::call(function()use($p){echo $this->t;}); } } $b = new b(); $b->test();
based on gZ6Mf
Output for 7.0.0 - 7.2.0
Deprecated: Non-static method a::call() should not be called statically in /in/6aCkZ on line 13 Notice: Undefined variable: p in /in/6aCkZ on line 6 5
Output for 5.6.8 - 5.6.28
Deprecated: Non-static method a::call() should not be called statically, assuming $this from incompatible context in /in/6aCkZ on line 13 Notice: Undefined variable: p in /in/6aCkZ on line 6 5
Output for 5.4.9 - 5.5.35
Strict Standards: Non-static method a::call() should not be called statically, assuming $this from incompatible context in /in/6aCkZ on line 13 Notice: Undefined variable: p in /in/6aCkZ on line 6 5
Output for 5.3.19 - 5.3.29
Strict Standards: Non-static method a::call() should not be called statically, assuming $this from incompatible context in /in/6aCkZ on line 13 Notice: Undefined variable: p in /in/6aCkZ on line 6 Fatal error: Using $this when not in object context in /in/6aCkZ on line 13
Process exited with code 255.