The PHP StdClass () is something this isn ' t well documented but I'll try to shed some light into the matter. StdClass is a default PHP object which have no predefined members. The name StdClass is used internally by Zend and is reserved. So, means, cannot define a class named StdClass in your PHP code.
It can used to manually instantiate generic objects which you can then set member variables for, this is useful for PAS Sing objects to and functions or methods which expect to take a object as an argument. An even more likely usage was casting an array to an object which takes each value in the array and adds it as a member Var Iable with the name based on the key in the array.
Here's an example below this converts an array to an object below. This method is called Type Casting.
$person = Array (
' FirstName ' = ' Richard ',
' LastName ' = ' Castera '
);
$p = (object) $person;
Echo $p->firstname; Would print ' Richard '
?>
http://www.bkjia.com/PHPjc/478580.html www.bkjia.com true http://www.bkjia.com/PHPjc/478580.html techarticle The PHP StdClass () is something, isnt well documented but I'll try to shed some light into the matter. StdClass is a default PHP object which have no predefined members. The N ...