} // test for a compound object $re = "/^(.+)(\\.cpd)\$/i"; $str = $pages['find']; preg_match($re, $str, $matches); //will determine if item is compound etc, and get values accordingly $process = true; if ($process) { if (isset($matches) && count($matches) == 0) { $isCompound = false; echo "\n\n Not Compound Object, nothing more to do...\n"; } if (isset($matches) && count($matches) == 3) { echo "\n\n Processing Compound Object:\n"; // information on each page of the compound object $compoundObj = json_decode($ingester->getCompoundObjectInfo($index, $pages['dmrecord']), true); $compoundObjType = $compoundObj['type']; if (array_key_exists('node', $compoundObj)) { //this was a single item, read as an array instead of array of arrays $compoundObjPage = $compoundObj['node']['page']; } else { if (array_key_exists('pageptr', $compoundObj['page'])) { //this was a single item, read as an array instead of array of arrays $compoundObjPage[] = $compoundObj['page']; } else { $compoundObjPage = $compoundObj['page']; } } // drill through each page in the individual record foreach ($compoundObjPage as $idxCtr => $page) { echo "\n\n\n\n" . json_encode($page) . "\n\n\n\n";