3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class ClassA { public function method_a (ClassB $b) {} } class ClassWrong{} $a = new ClassA; $a->method_a(new ClassWrong); echo 'done.'; /* throw new MyException('This is a really bad error', 123); final public ExceptionException::getPrevious ( void ) error_reporting(E_ALL); function exception_error_handler($errno, $errstr, $errfile, $errline ) { throw new ErrorException($errstr, '00007600', $errno, $errfile, $errline, new Exception('jjj')); } set_error_handler("exception_error_handler"); try { echo $x; } catch(Exception $e) { var_dump($e->getPrevious()); }*/
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught TypeError: Argument 1 passed to ClassA::method_a() must be an instance of ClassB, instance of ClassWrong given, called in /in/jP2QC on line 11 and defined in /in/jP2QC:5 Stack trace: #0 /in/jP2QC(11): ClassA->method_a(Object(ClassWrong)) #1 {main} thrown in /in/jP2QC on line 5
Process exited with code 255.
Output for hhvm-3.12.0
Fatal error: Uncaught TypeError: Argument 1 passed to ClassA::method_a() must be an instance of ClassB, ClassWrong given in /in/jP2QC:5 Stack trace: #0 /in/jP2QC(11): ClassA->method_a() #1 {main}
Process exited with code 255.
Output for hhvm-3.10.0
Catchable fatal error: Argument 1 passed to ClassA::method_a() must be an instance of ClassB, ClassWrong given in /in/jP2QC on line 5
Process exited with code 255.
Output for 5.2.0 - 5.6.28
Catchable fatal error: Argument 1 passed to ClassA::method_a() must be an instance of ClassB, instance of ClassWrong given, called in /in/jP2QC on line 11 and defined in /in/jP2QC on line 5
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'ClassB' not found in /in/jP2QC on line 5
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/jP2QC on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/jP2QC on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/jP2QC on line 5
Process exited with code 255.