Hello All,
I was stuck with this issue. So just felt the need to reach out to other
strugglers.
May be people might enjoy this:
Here is the code for object to array and array to object conversion:
function object_2_array($data)
{
if(is_array($data) || is_object($data))
{
$result = array();
foreach ($data as $key => $value)
{
$result[$key] = object_2_array($value);
}
return $result;
}
return $data;
}
function array_2_object($array) {
$object = new stdClass();
if (is_array($array) && count($array) > 0) {
foreach ($array as $name=>$value) {
$name = strtolower(trim($name));
if (!empty($name)) {
$object->$name = $value;
}
}
}
return $object;
}
have fun !!!!!
Thanks