3v4l.org

run code in 300+ PHP versions simultaneously
<?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();
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.5.24 - 5.5.31, 5.6.8 - 5.6.17
Parse error: syntax error, unexpected '$this' (T_VARIABLE) in /in/NrnCS on line 19
Process exited with code 255.

preferences:
167.97 ms | 1395 KiB | 28 Q