Creating a new standard object in PHP 5 is simply achieved by using stdClass:
$obj = new stdClass;
another possible way:
$obj = (object) array()
yet another – slightly more complicated method to achieve the above:
class foo {}; //must be declared on top level
$object = new foo();
It’s a bit difficult to get this information from the PHP docs.
Comments
Leave a comment Trackback