News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

David Otton's Blog:
PHP Tip Classes Aren't Derived From stdClass
November 16, 2008 @ 10:54:53

David Otton has shared a discovery he's come across in his development - user-defined classes are not derived from stdClass.

Many OO languages have the concept of a single base class from which all other classes are explicitly or implicitly descended. For example, Ruby, Java and .NET all have Object. It's a very common belief that PHP implements stdClass as a base class for all objects, but this is in fact not the case.

He illustrates with a code example showing the results of calls to instanceof with a normal user class and one that extends the stdClass object.

0 comments voice your opinion now!
class stdclass standard example instanceof


blog comments powered by Disqus

Similar Posts

David Coallier's Blog: PHP Namespaces (Part 1: Basic usage & gotchas)

Builder.com.au: How do I...recursively scan directories with PHP's DirectoryIterators?

Community News: Big Nerd Ranch - PHP5 Bootcamp - 5-Day Intensive Training

Ivo Jansch's Blog: Mixins in PHP

Matthew Weir O'Phinney's Blog: Login and Authentication with Zend Framework


Community Events





Don't see your event here?
Let us know!


interview laravel api zendserver tips introduction library series framework release opinion deployment list language podcast install symfony community package update

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework