3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php namespace derp { class Foo {} } namespace herp { class BetterFoo extends \derp\Foo {} class Derp { public function __construct(DerpFoo $foo) {} } class_alias('DerpFoo', '\derp\Foo'); $f = new Derp(new BetterFoo); }
Output for 7.0.0 - 7.1.0
Warning: Class 'DerpFoo' not found in /in/r5VqM on line 18 Fatal error: Uncaught TypeError: Argument 1 passed to herp\Derp::__construct() must be an instance of herp\DerpFoo, instance of herp\BetterFoo given, called in /in/r5VqM on line 20 and defined in /in/r5VqM:14 Stack trace: #0 /in/r5VqM(20): herp\Derp->__construct(Object(herp\BetterFoo)) #1 {main} thrown in /in/r5VqM on line 14
Process exited with code 255.
Output for hhvm-3.12.0
Warning: Class DerpFoo not found in /in/r5VqM on line 18 Catchable fatal error: Argument 1 passed to herp\Derp::__construct() must be an instance of herp\DerpFoo, herp\BetterFoo given in /in/r5VqM on line 14
Process exited with code 255.
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.3.0 - 5.6.28
Warning: Class 'DerpFoo' not found in /in/r5VqM on line 18 Catchable fatal error: Argument 1 passed to herp\Derp::__construct() must be an instance of herp\DerpFoo, instance of herp\BetterFoo given, called in /in/r5VqM on line 20 and defined in /in/r5VqM on line 14
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_STRING in /in/r5VqM on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_STRING in /in/r5VqM on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/r5VqM on line 3
Process exited with code 255.