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 NrnCS
Output for 7.1.0 - 7.2.0
Fatal error: Uncaught ArgumentCountError: Too few arguments to function Fish::__construct(), 0 passed in /in/8vSKM on line 25 and exactly 3 expected in /in/8vSKM:10 Stack trace: #0 /in/8vSKM(25): Fish->__construct() #1 {main} thrown in /in/8vSKM on line 10
Process exited with code 255.
Output for 7.0.0 - 7.0.20
Warning: Missing argument 1 for Fish::__construct(), called in /in/8vSKM on line 25 and defined in /in/8vSKM on line 10 Warning: Missing argument 2 for Fish::__construct(), called in /in/8vSKM on line 25 and defined in /in/8vSKM on line 10 Warning: Missing argument 3 for Fish::__construct(), called in /in/8vSKM on line 25 and defined in /in/8vSKM on line 10 Notice: Undefined variable: name in /in/8vSKM on line 11 Notice: Undefined variable: flavor in /in/8vSKM on line 12 Notice: Undefined variable: record in /in/8vSKM on line 13 Notice: Undefined variable: common_name in /in/8vSKM on line 18 Fatal error: Uncaught Error: Cannot access empty property in /in/8vSKM:18 Stack trace: #0 /in/8vSKM(27): Fish->getInfo() #1 {main} thrown in /in/8vSKM on line 18
Process exited with code 255.
Output for 5.3.21 - 5.6.28
Warning: Missing argument 1 for Fish::__construct(), called in /in/8vSKM on line 25 and defined in /in/8vSKM on line 10 Warning: Missing argument 2 for Fish::__construct(), called in /in/8vSKM on line 25 and defined in /in/8vSKM on line 10 Warning: Missing argument 3 for Fish::__construct(), called in /in/8vSKM on line 25 and defined in /in/8vSKM on line 10 Notice: Undefined variable: name in /in/8vSKM on line 11 Notice: Undefined variable: flavor in /in/8vSKM on line 12 Notice: Undefined variable: record in /in/8vSKM on line 13 Notice: Undefined variable: common_name in /in/8vSKM on line 18 Fatal error: Cannot access empty property in /in/8vSKM on line 18
Process exited with code 255.