An object is created (/ instantiated) using the keyword new to assign the class to the user defined object name.

e.g. $myObject = new className ;


This example uses the var_export() function to view the contents of the object:

Save & refresh browser:

Instantiating a Bike Object



The var_export() function is showing a NULL output since the class is empty (i.e. it has no members; properties/methods).

Leave a Reply