Sunday, 15 July 2012

php - How do I get the value from object(stdClass)? -



php - How do I get the value from object(stdClass)? -

using php, have parse string coming code in format this:

object(stdclass)(4) { ["title"]=> string(5) "fruit" ["color"]=> string(6) "yellow" ["name"]=> string(6) "banana" ["id"]=> int(3) }

i'm sure there's simple solution, can't seem find it... how color , name?

thanks much.

you can do: $obj->title etcetera.

or can turn array:

$array = get_object_vars($obj);

php parsing

No comments:

Post a Comment