3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo{ function isFoo(){} } (function(){ /** @var Foo $this */ var_dump($this->isFoo()); }) ->bindTo(new Foo) ->bindTo(new stdclass) ();
Output for 8.4.1 - 8.4.12
Fatal error: Uncaught Error: Call to undefined method stdClass::isFoo() in /in/T1eGX:7 Stack trace: #0 /in/T1eGX(11): Closure->{closure:/in/T1eGX:5}() #1 {main} thrown in /in/T1eGX on line 7
Process exited with code 255.
Output for 8.2.0 - 8.2.29, 8.3.0 - 8.3.25
Fatal error: Uncaught Error: Call to undefined method stdClass::isFoo() in /in/T1eGX:7 Stack trace: #0 /in/T1eGX(11): Closure->{closure}() #1 {main} thrown in /in/T1eGX on line 7
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33
Fatal error: Uncaught Error: Call to undefined method stdClass::isFoo() in /in/T1eGX:7 Stack trace: #0 /in/T1eGX(10): Closure->{closure}() #1 {main} thrown in /in/T1eGX on line 7
Process exited with code 255.
Output for 5.5.0 - 5.5.35, 5.6.0 - 5.6.28
Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR) in /in/T1eGX on line 9
Process exited with code 255.

preferences:
117.16 ms | 410 KiB | 5 Q