PHP Object



An object is a data type that allows for the storage of not only data but also information on how to process that data.


PHP is capable of functioning as an object-oriented programming language (or OOP).

Example : 

<?php
class Car
{
  var $color;
  function Car($color="green")
  {
    $this->color = $color;
  }
  function what_color()
  {
    return $this->color;
  }
}
?>

Comments