![]() |
easy way to cast stdClass object into instance of my own class? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: easy way to cast stdClass object into instance of my own class? (/showthread.php?tid=15075) |
easy way to cast stdClass object into instance of my own class? - El Forum - 01-25-2009 [eluser]sophistry[/eluser] i have a stdClass object returned from the imap email extension function: imap_headerinfo() i want to convert that stdClass object (or basically get its properties) into a message_header class that i wrote - it has methods i wrote that deal with the email header data. here's how i am doing it now in a method (i'm not happy about this way, i found it on the comments for the php.net OO manual page) Code: function _set_class_vars( &$obj ) is there another way to do this? like "type casting" from stdClass to custom class. thanks in advance for any advice around this subject. |