得到子级数组
@param int
@return array
426112
public function get_child($myid) {
        $a = $newarr = array();
        if (is_array($this->arr)) {
            foreach ($this->arr as $id => $a) {
                if ($a['parent_id'] == $myid)
                    $newarr[$id] = $a;
            }
        }
        return $newarr ? $newarr : false;
    }
1176024
public function getLevels(int $from = 1, ?int $to = null, ?callable $callback = null): array
    {
        $parts = explode('.', $this->env);
        $n = isset($to) ? min(count($parts), $to) : count($parts);

        $levels = [];

        for ($i = $from; $i <= $n; $i++) {
            $level = join('.', array_slice($parts, 0, $i));
            $levels[] = isset($callback) ? $callback($level) : $level;
        }

        return $levels;
    }
72797
public function getChildren()
    {
        $children = array();

        $wpTerms = get_terms($this->taxonomy->getName(), array(
            'hide_empty' => false,
            'parent'     => (int) $this->getId()
        ));

        foreach ($wpTerms as $termData) {
            $children[] = $this->termFactory->create($termData, $this->taxonomy);
        }

        return $children;
    }
140415
public function collectChildren()
    {
        if ($this->hasChildrenRelation()) {
            $result = $this->getRelation($this->getChildrenRelationIndex());
        } else {
            $result = $this->children();
        }

        return $result;
    }
78837
public function getValue()
    {
        $values = [];
        
        $this->getChildren()->forAll(function (ElementInterface $child) use (&$values) {
            foreach ($this->locales as $locale) {
                $values[$locale['code']][$child->getName()] = $this->getChildValue($child, $locale['code']);
            }
        });
        
        return $values;
    }
544873
public function dump()
    {
        if ($this->hasChildren()) {
            $dump = [];
            foreach ($this->children as $child) {
                $dump[$child->getName()] = $child->dump();
            }
        } elseif (count($this->getValues()) === 1 && (!$this->hasTemplate() || !$this->getTemplate()->multiple_values)) {
            $dump = $this->values[0];
        } else {
            $dump = $this->values;
        }
        return $dump;
    }
1138628
public function getChildren()
    {
        $nodes = [];
        $iterator = new \FilesystemIterator(
            $this->path,
            \FilesystemIterator::CURRENT_AS_SELF
          | \FilesystemIterator::SKIP_DOTS
        );

        foreach ($iterator as $entry) {
            $nodes[] = $this->getChild($entry->getFilename());
        }

        return $nodes;
    }
1286433
public function getSiblings() {
        $parent = $this->getParent();
        if (is_null($parent)) {
            // This is the root node.
            return [];
        }

        $children = $parent->getChildren();
        $index = array_search($this, $children);
        unset($children[$index]);
        return $children;
    }
260704
public function getChildren()
    {
        if (isset($this->relations['children'])) {
            return $this->relations['children'];
        }

        $children = $this->getAttribute('children');

        return $children === null ? [] : $children;
    }
1031240
public function numberOfChildren(): int
    {
        if (preg_match('/\n1 NCHI (\d+)(?:\n|$)/', $this->gedcom(), $match)) {
            return (int) $match[1];
        }

        $children = [];
        foreach ($this->spouseFamilies() as $fam) {
            foreach ($fam->children() as $child) {
                $children[$child->xref()] = true;
            }
        }

        return count($children);
    }
512671
public function getAllLocalizations()
    {
        $localizations = [];
        if (null !== $this->getChildren() && count($this->getChildren()) > 0) {
            foreach ($this->getChildren() as $child) {
                $localizations[] = $child;
                $localizations = array_merge($localizations, $child->getAllLocalizations());
            }
        }

        return $localizations;
    }
134011
protected function getChildren()
    {
        $retArray = [];

        foreach ($this->elements as $element => $occurrence) {
            switch ($occurrence) {
                case 'REQUIRED':
                case self::REQUIRED:
                    if (property_exists($this, $element)) {
                        $retArray[] = [
                            'name'          => $this->ns.$element,
                            'attributes'    => array_filter($this->$element->attributes),
                            'value'         => $this->$element
                        ];
                    } else {
                        die(
                            $this->getShortName(get_called_class()) .": Required element '{$element}' missing."
                        );
                    }
                    break;
                case 'OPTIONAL':
                case self::OPTIONAL:
                    if (property_exists($this, $element)) {
                        $retArray[] = [
                            'name'          => $this->ns.$element,
                            'attributes'    => array_filter($this->$element->attributes),
                            'value'         => $this->$element
                        ];
                    }
                    break;
                case 'REQUIRED_MULTI':
                case self::REQUIRED_MULTI:
                    if (property_exists($this, $element)) {
                        foreach ($this->$element as $child) {
                            $retArray[] = [
                                'name'          => $this->ns.$element,
                                'attributes'    => array_filter($child->attributes),
                                'value'         => $child
                            ];
                        }
                    } else {
                        die(
                            $this->getShortName(get_called_class()) .": Required element '{$element}' missing."
                        );
                    }
                    break;
                case 'OPTIONAL_MULTI':
                case self::OPTIONAL_MULTI:
                    if (property_exists($this, $element)) {
                        foreach ($this->$element as $child) {
                            $retArray[] = [
                                'name'          => $this->ns.$element,
                                'attributes'    => array_filter($child->attributes),
                                'value'         => $child
                            ];
                        }
                    }
                    break;
                default:
                    die(
                        $this->getShortName(get_called_class()) .": Unknown occurence type for element {$element}."
                    );
            }
        }

        return $retArray;
    }
201738
public function getChildren()
    {
        $driveLocator = "/drives/{$this->parentReference->driveId}";
        $itemLocator  = "/items/{$this->id}";
        $endpoint     = "$driveLocator$itemLocator/children";

        $response = $this
            ->graph
            ->createCollectionRequest('GET', $endpoint)
            ->execute();

        $status = $response->getStatus();

        if ($status != 200) {
            throw new \Exception("Unexpected status code produced by 'GET $endpoint': $status");
        }

        $driveItems = $response->getResponseAsObject(DriveItem::class);

        if (!is_array($driveItems)) {
            return [];
        }

        return array_map(function (DriveItem $driveItem) {
            return new self($this->graph, $driveItem);
        }, $driveItems);
    }
1143458
protected function getChildrenIdsInternal()
    {
        if (empty($this->owner->{$this->pkField})) {
            $method = __METHOD__ . '()';
            throw new NotFoundHttpException("{$this->owner->className()}()必须先通过`{$this->pkField}`主键获取相关数据后才能执行操作：{$method}");
        }
        
        $_childrenIds = [];
        if (method_exists($this, 'getAll')) {
            $all = $this->owner->getAll();
            if ($all) {
                $children = ArrayHelper::listSearch($all, [
                    $this->parentField => $this->owner->{$this->pkField},
                ]);
                while (count($children) > 0) {
                    $first = array_shift($children);
                    $_childrenIds[] = (int)$first[$this->pkField];
                    
                    $next = ArrayHelper::listSearch($all, [
                        $this->parentField => $first[$this->pkField],
                    ]);
                    if (count($next) > 0) {
                        $children = array_merge($children, $next);
                    }
                }
            }
        }
        
        return $_childrenIds;
    }
1183487
public function GetAllChildrenIds()
    {
        $aChildIdList = $this->GetFromInternalCache('aChildIdList');
        if (null !== $aChildIdList) {
            return $aChildIdList;
        }
        $aChildIdList = array();
        $oChildren = &$this->GetChildren();
        while ($oChild = &$oChildren->Next()) {
            $aChildIdList[] = $oChild->id;
            $aChildChildIdList = $oChild->GetAllChildrenIds();
            $aChildIdList = array_merge($aChildIdList, $aChildChildIdList);
        }
        $this->SetInternalCache('aChildIdList', $aChildIdList);

        return $aChildIdList;
    }
1331818
public function get_children() {
        if (!$this->lf->is_directory()) {
            return array();
        }

        $result = array();
        $fs = get_file_storage();

        $storedfiles = $fs->get_directory_files($this->context->id, $this->lf->get_component(), $this->lf->get_filearea(), $this->lf->get_itemid(),
                                                $this->lf->get_filepath(), false, true, "filepath, filename");
        foreach ($storedfiles as $file) {
            $result[] = new file_info_stored($this->browser, $this->context, $file, $this->urlbase, $this->topvisiblename,
                                             $this->itemidused, $this->readaccess, $this->writeaccess, false);
        }

        return $result;
    }
391642
public function getCollectionChildren()
    {
        $children = [];
        $db = Database::connection();
        $q = 'select cID from Pages where cParentID = ? and cIsTemplate = 0 order by cDisplayOrder asc';
        $r = $db->executeQuery($q, [$this->getCollectionID()]);
        if ($r) {
            while ($row = $r->fetchRow()) {
                if ($row['cID'] > 0) {
                    $c = self::getByID($row['cID']);
                    $children[] = $c;
                }
            }
        }

        return $children;
    }