Skip to content

Instantly share code, notes, and snippets.

@datacodesolutions
Created September 11, 2012 14:35
Show Gist options
  • Save datacodesolutions/3699172 to your computer and use it in GitHub Desktop.
Save datacodesolutions/3699172 to your computer and use it in GitHub Desktop.
Array to Object
function array_to_object($array) {
$return = new stdClass();
foreach ($array as $k => $v) {
if (is_array($v)) {
$return->$k = $this->array_to_object($v);
}
else {
$return->$k = $v;
}
}
return $return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment