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();

Abusive script

This script was stopped while abusing our resources

Output for 7.1.1 - 7.1.12, 7.1.14, 7.1.16, 7.1.21 - 7.1.33, 7.2.0 - 7.2.26, 7.3.0 - 7.3.13, 7.4.0 - 7.4.1
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 5.5.31, 5.6.0 - 5.6.1, 5.6.20, 5.6.33 - 5.6.34, 7.0.3, 7.0.10, 7.0.12, 7.0.14, 7.1.0, 7.1.13, 7.1.15, 7.1.17 - 7.1.20

Process exited with code 137.
Output for 7.0.0 - 7.0.2, 7.0.4 - 7.0.9, 7.0.11, 7.0.13, 7.0.15 - 7.0.33
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.5.0 - 5.5.30, 5.5.32 - 5.5.38, 5.6.2 - 5.6.19, 5.6.21 - 5.6.32, 5.6.35 - 5.6.40
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.

preferences:
146.43 ms | 403 KiB | 196 Q