Run ❯
Get your
own PHP
server
Result Size:
625 x 565
×
Change Orientation
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <body> <?php class Car { public $color; public $model; public function __construct($color, $model) { $this->color = $color; $this->model = $model; } } $myCar = new Car("red", "Volvo"); foreach ($myCar as $x => $y) { echo "$x: $y<br>"; } ?> </body> </html>
color: red
model: Volvo