Skip to content

Instantly share code, notes, and snippets.

@markupboy
Created July 20, 2010 13:30
Show Gist options
  • Save markupboy/482954 to your computer and use it in GitHub Desktop.
Save markupboy/482954 to your computer and use it in GitHub Desktop.
<?php
function objectsIntoArray($arrObjData, $arrSkipIndices = array()) {
$arrData = array();
if (is_object($arrObjData)) {
$arrObjData = get_object_vars($arrObjData);
}
if (is_array($arrObjData)) {
foreach ($arrObjData as $index => $value) {
if (is_object($value) || is_array($value)) {
$value = objectsIntoArray($value, $arrSkipIndices);
}
if (in_array($index, $arrSkipIndices)) {
continue;
}
$arrData[$index] = $value;
}
}
return $arrData;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment