ages ago I remember you were looking for a way to convert $array['value'] into pretty $array->value objects, today I bumped into this on phpfreaks:
Untested personally, but I can't see it not working
Code:
function arr2obj($arg_array) {
$tmp = new stdClass; // start off a new (empty) object
foreach ($arg_array as $key => $value) {
if (is_array($value)) { // if its multi-dimentional, keep going :)
$tmp->$key = arr2obj($value);
} else {
if (is_numeric($key)) { // can't do it with numbers :(
die("Cannot turn numeric arrays into objects!");
}
$tmp->$key = $value;
}
}
return $tmp; // return the object!
}
Untested personally, but I can't see it not working
