3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Auto{ private $farba; private $nazov; public function _construct2($farba, $nazov){ $this->farba = $farba; $this->nazov = $nazov; } public function getFarba(){ return $this->farba; } public function getNazov(){ return $this->nazov; } public function _toString(){ return "Auto: {$this->nazov} {$this->farba}"; } } $cars = array(new Auto("Zlta", "Volvo"), new Auto("Cervena", "Skoda"), new Auto("Zelena", "Octavia")); $car = new Auto("Fialova", "Toyota"); echo $car; ?>
based on VSsNd
Output for 7.1.0 - 7.2.0
Recoverable fatal error: Object of class Auto could not be converted to string in /in/lQRvp on line 27
Process exited with code 255.
Output for 5.3.19 - 7.0.20
Catchable fatal error: Object of class Auto could not be converted to string in /in/lQRvp on line 27
Process exited with code 255.