Objects In PHP
Objects
Object
is an instance of your class without object there no use of class.If we have class then we need to create object of the class to solve our problem using class. You can create object of your class by using new keyword.
$objClass = new MyClass();
<?php
class MyClass
{
function createObject()
{
echo "creating object of class MyClass";
}
}
$bar = new MyClass;
$bar->createObject();
?>
live example : http://ideone.com/U11PMO
Tutorials Class - Output Window
creating object of class MyClass
Congratulations! Chapter Finished. Learn more about the similar topics:
Exercises & Assignments |
---|
No Content Found. |
Interview Questions & Answers |
---|
No Content Found. |