Home Tutorial Php Phpbasics Tutorial PHP Object Type


Share on Google+Share on Google+
PHP Object Type
Posted on: March 16, 2010 at 12:00 AM
This PHP tutorial will reveal some interesting concepts of object, in addition it gives you a glimpse on object in PHP.

PHP Object:

Class, and Object are one of the most important feature of OOP. Object is the instance of a class, to create an object we use new keyword.

In PHP we can convert any value to an object of a predefined class called stdClass. The value of any variable is stored in a member variable of the class (stdClass) called scalar.

Note: In the following examples there is no closing tag is included, since it is optional to add the end tag when no html coding is embedded.

PHP Object Example:


class A


private $a=12;

public function display()


echo $this->a;



$obj=new A();








echo $obj->scalar;





Related Tags for PHP Object Type:

Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: March 16, 2010

Recommend the tutorial

Advertisements Advertisements