Posted by Janwillem Borleffs on 11/05/84 11:49
Skrol29 wrote:
> Unfortunately the few that the documentation officially tells about
> this class is:
> ******************************
> The name stdClass is used internally by Zend and is reserved. You
> cannot have a class named stdClass in PHP.
> http://www.php.net/manual/en/language.oop.php
> ******************************
>
> It seems that some Pear packages instanciate this class.
> But should we do the same for code intended for public releases?
>
This just means you cannot do:
class stdClass {}
But can savely do:
$foo = new stdClass;
Another example:
$obj = (object) null;
print is_a($obj, 'stdClass') ? 1 : 0;
Or:
$obj = (object) null;
print $obj instanceof stdClass ? 1 : 0;
Both print 1...
JW
[Back to original message]
|