3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A { private static $sfoo = 1; private $ifoo = 2; } $cl1 = static function() { return A::$sfoo; }; $cl2 = function() { return $this->ifoo; }; $bcl1->bindTo($cl1, null, 'A'); $bcl2->bindTo($cl2, new A(), 'A'); echo $bcl1(), "\n"; echo $bcl2(), "\n";
Output for 7.0.5 - 7.2.0
Notice: Undefined variable: bcl1 in /in/pbbPH on line 14 Fatal error: Uncaught Error: Call to a member function bindTo() on null in /in/pbbPH:14 Stack trace: #0 {main} thrown in /in/pbbPH on line 14
Process exited with code 255.
Output for 7.0.0 - 7.0.4
Notice: Undefined variable: bcl1 in /in/pbbPH on line 14 Fatal error: Uncaught Error: Call to a member function bindTo() on unknown in /in/pbbPH:14 Stack trace: #0 {main} thrown in /in/pbbPH on line 14
Process exited with code 255.
Output for 5.6.8 - 5.6.21
Notice: Undefined variable: bcl1 in /in/pbbPH on line 14 Fatal error: Call to a member function bindTo() on null in /in/pbbPH on line 14
Process exited with code 255.
Output for 5.4.11 - 5.5.35
Notice: Undefined variable: bcl1 in /in/pbbPH on line 14 Fatal error: Call to a member function bindTo() on a non-object in /in/pbbPH on line 14
Process exited with code 255.
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected T_FUNCTION, expecting T_PAAMAYIM_NEKUDOTAYIM in /in/pbbPH on line 7
Process exited with code 255.