Object In PHP
What is object in php
Objects or Instances can be created for a class to access the class components. The below PHP code shows how to create an object to the Car() class and it is used to access the class components.
- Class is a collection of objects. Object has properties and behavior.
Example Of Objects
class Car{
private $carModal = "Alto";
public function getModal() {
return $this->carModal;
}
}
$carObj= new Car();
echo "<b>Car Modal:</b> " . $carObj->getModal() . "<br/>";
