sepehr
8/27/2012 - 8:53 AM

PHP: Recursively cast an object into array

PHP: Recursively cast an object into array

<?php

/**
 * Recursively casts an object into array.
 *
 * @param $object 
 *   Object to cast to array.
 *
 * @return array
 */
function object_to_array($object)
{
	return json_decode(json_encode($object), true);
}