Run ❯
Get your
own PHP
server
❯
Run Code
Ctrl+Alt+R
Change Orientation
Ctrl+Alt+O
Change Theme
Ctrl+Alt+D
Go to Spaces
Ctrl+Alt+P
name = $name; $this->color = $color; } public function intro() { echo "The fruit is $this->name and the color is $this->color."; } } class Strawberry extends Fruit { public $weight; public function __construct($name, $color, $weight) { $this->name = $name; $this->color = $color; $this->weight = $weight; } public function intro() { echo "A $this->name is $this->color, and the weight is $this->weight gram."; } } $strawberry = new Strawberry("Strawberry", "red", 50); $strawberry->intro(); ?>
A Strawberry is red, and the weight is 50 gram.