3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Fish { public $common_name; public $flavor; public $record_weight; function __construct($name, $flavor, $record){ $this->common_name = $name; $this->flavor = $flavor; $this->record_weight= $record; } public function getInfo(){ return "A Largemouth Bass is an Excellent flavored fish. The world record weight is 22 pounds 5 ounces." . $this->$common_name $this->$flavor $this->$record_weight; } } $f = new Fish(); $bass = new Fish("Largemouth Bass","Excellent","22 pounds 5 ounces"); echo $f->getInfo();
based on YlGUO
Output for 7.0.0 - 7.0.2
Parse error: syntax error, unexpected '$this' (T_VARIABLE), expecting ';' in /in/NrnCS on line 19
Process exited with code 255.
Output for 5.4.11 - 5.6.17
Parse error: syntax error, unexpected '$this' (T_VARIABLE) in /in/NrnCS on line 19
Process exited with code 255.
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected T_VARIABLE in /in/NrnCS on line 19
Process exited with code 255.