Exemplo n.º 1
0
function inspect_data($path, $depth)
{
    $data = file_get_contents($path);
    //, FILE_BINARY);
    $map = clb_blob_dec($data);
    qpre(pfind_shallow($map, $depth));
}
Exemplo n.º 2
0
function pfind_shallow($tree, $target, $depth = 0)
{
    if (!is_array($tree)) {
        return $tree;
    }
    if ($depth < $target) {
        foreach ($tree as $key => $branch) {
            $tree[$key] = pfind_shallow($branch, $target, $depth + 1);
        }
        return $tree;
    } else {
        return '(' . count($tree) . ' nodes)';
    }
}