PHP Object
PHP Object An object is a data type (on your requirements) which stores data on how to process that data.In PHP, an object must be explicitly declared.
First we must declare a class of object.
For this, we use the class keyword.
some time we declare constructor.
A class is a structure that can contain properties and methods(constructor ,distructor ):
Example
class Car {
function Car() {
$this->model = “Honda";
}
}
// create an object
$fahad = new Car();
// show object properties
echo $fahad->model;
?>
Its OUTPUT like
Honda
No comments