3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php abstract class Object { public abstract function toString( ); public abstract function equals( self &$o ); } class Chair extends Object { public function toString( ) { return 'This is a chair.'; } public function equals( self &$o ) { return TRUE; } } class Table extends Object { public function toString( ) { return 'This is a table.'; } public function equals( self &$o ) { return TRUE; } } $chair = new Chair(); $table = new Table(); echo $chair->equals( $table );
Output for 5.4.1 - 5.5.1
Fatal error: Declaration of Chair::equals() must be compatible with Object::equals(Object &$o) in /in/DGIs5 on line 20
Process exited with code 255.
Output for 5.2.0 - 5.4.0
Catchable fatal error: Argument 1 passed to Chair::equals() must be an instance of Chair, instance of Table given, called in /in/DGIs5 on line 38 and defined in /in/DGIs5 on line 16
Process exited with code 255.
Output for 5.1.0 - 5.1.6
Fatal error: Argument 1 passed to Chair::equals() must be an instance of Chair, called in /in/DGIs5 on line 38 and defined in /in/DGIs5 on line 16
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Fatal error: Argument 1 must be an instance of Chair in /in/DGIs5 on line 16
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_CLASS in /in/DGIs5 on line 3
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_CLASS in /in/DGIs5 on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/DGIs5 on line 3
Process exited with code 255.