3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php interface VehicleInterface { public function getName(); } class AutoClass implements VehicleInterface { private $name; public function __construct( $name) { $this->name = $name; } public function getName() { return $this->name; } } class MotoClass implements VehicleInterface { protected $name; public function getName() { return $this->name; } } $auto = new AutoClass(); $test = function(VehicleInterface $vehicle) { return $vehicle->getName(); } $auto = new AutoClass('Audi'); echo $test();
Output for 5.4.0 - 5.4.34
Parse error: syntax error, unexpected '$auto' (T_VARIABLE) in /in/WqnLZ on line 53
Process exited with code 255.
Output for 5.3.0 - 5.3.29
Parse error: syntax error, unexpected T_VARIABLE in /in/WqnLZ on line 53
Process exited with code 255.
Output for 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION in /in/WqnLZ on line 44
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION in /in/WqnLZ on line 44
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING in /in/WqnLZ 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_STRING in /in/WqnLZ on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/WqnLZ on line 3
Process exited with code 255.