Objects in php

February 17, 2013
Posted by admin 2:59 PM

Object is  an concrete entity constructed using the blueprint provided by  class. The class specifies the behaviors and characteristic of   object but it doesn’t specify the value of those characteristics. With a single class we can make several instances of the same class .In OOP we can make object  from class by instantiation.  For creating a new object we use the word new to instantiate a class
class classname
public  variable name;                                                                                            //property of class
public  function  function_name(parameter,parameter2…parameter_n)     //method of class
$object_name=new class_name;
$object_name->function_name();                                                                           //calling the function from object

In PHP we can called a method from object by using arrow(->).We can make multiple objects from same class using the keyword new.