Converting an array
/stdClass
-> stdClass
$stdClass = json_decode(json_encode($booking));
Converting an array
/stdClass
-> array
The manual specifies the second argument of json_decode
as:
assoc
WhenTRUE
, returned objects will be converted into associative arrays.
Hence the following line will convert your entire object into an array:
$array = json_decode(json_encode($booking), true);
I found this on: http://stackoverflow.com/questions/18576762/php-stdclass-to-array
Leave a Reply
You must be logged in to post a comment.