ID:               28462
 User updated by:  bart at mediawave dot nl
 Reported By:      bart at mediawave dot nl
 Status:           Open
 Bug Type:         Feature/Change Request
 Operating System: Irrelevant
 PHP Version:      5.0.0RC2
 New Comment:

Another option is to simply add the array as a property to the custom
object. Then use __get() and __set() to simulate object properties with
the array.


Previous Comments:
------------------------------------------------------------------------

[2004-05-20 22:51:22] bart at mediawave dot nl

Description:
------------
A lot of functions in PHP return arrays in stead of objects. Of course
it's possible to simply cast the return value to an object like:

$urlObject = (object) parse_url($url);

But then I would get an instance of the stdClass. I can imagine
situations where people would like to cast arrays into properties of
their own custom objects. Maybe something like:

cast_array2object($array, $someCustomObject);

or something like:

$this .= (object) parse_url($url);



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=28462&edit=1

Reply via email to