#7 - PHP Class and Objects
Class
A class is a template or a blueprint for objects. It is analogous to a map of a house, while a house is an object based on the outlines of the map. PHP uses the class keyword to create a class.
xxxxxxxxxx
20
<?php
class Car{
public $color;
public $wheels;
public $model;
function __construct($color,$wheels,$model){
$this ->color = $color;
$this ->wheels = $wheels;
$this ->model = $model;
}
function get_color(){
return $this->color;
}
}
?>
OUTPUT
:001 > Cmd/Ctrl-Enter to run, Cmd/Ctrl-/ to comment