PHP: Array to Object

// You can typecast a single array into an object.
$array = (
	'foo' => 'Hello',
	'bar' => 'Hows life?',
	'baz' => 'Nice day'
);

$object = (object) $array;
// Optionally, you could use the settype function.
settype($array,'object')
// For a multi-dimensional array, you could do this:
function array2object($array) 
{
	$object = (object) $array;

	foreach ($object as $key)
	{
		if (is_array($key)) {
			array2object($key);
		}
	}
	return $object;
}

array2object($array);