3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private $test = null; public $anything = true; private function getTest() { return $this->test; } } function doStuff() { echo $this->test; echo $this->getTest(); echo $this->anything; } $a = new A(); $fn = doStuff->bindTo($a, $a); $fn();
Output for 8.1.23 - 8.1.28, 8.2.10 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught Error: Undefined constant "doStuff" in /in/A4hfH:27 Stack trace: #0 {main} thrown in /in/A4hfH on line 27
Process exited with code 255.
Output for 5.4.0 - 5.4.18, 5.5.0 - 5.5.2
Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR) in /in/A4hfH on line 27
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/A4hfH on line 27
Process exited with code 255.

preferences:
87.03 ms | 401 KiB | 77 Q