Possible Duplicate:
PHP ToString() equivalent
I get this error:
Catchable fatal error: Object of class stdClass could not be converted to string
So, my question is, how do I convert an object to a string in PHP? I don’t want to serialize it though.
Just a note: the code I use works in PHP 4, but not in PHP 5
Thanks!
EDIT: I resolved it myself. It was a pain, but I did it. Thanks anyway, everyone 🙂
Why do you need this string? If you just need to visualize it for debugging, you can use
var_dump(),print_r(), or$s = print_r($var, 1);to really make it into a string for further theming. If you need to send the object as text to somewhere else (database, Javascript code), you have a choice of serialize, json_encode, XML conversion, and many more, depending on your exact situation.