Convert array to object and object to array in PHP

by admin on November 1st, 2012

convert array to object PHP

$obj = json_decode (json_encode ($var), FALSE);
where $var is an array.

convert object to array PHP

$arr = json_decode( json_encode($var), true);
where $var is an object


Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>