3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Courier { public $name; public $home_country; public function __construct($name, $home_country) { $this->name = $name; $this->home_country = $home_country; return true; } public function __toString() { return $this->name . '(' . $this->home_country . ')'; } } $myCourier = new Courier('abc', 'USA'); var_dump($myCourier); echo serialize($myCourier);
based on B5CNC
Output for 5.0.0 - 7.2.0
object(Courier)#1 (2) { ["name"]=> string(3) "abc" ["home_country"]=> string(3) "USA" } O:7:"Courier":2:{s:4:"name";s:3:"abc";s:12:"home_country";s:3:"USA";}
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/bN8RL on line 4
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/bN8RL on line 4
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/bN8RL on line 4
Process exited with code 255.