createClone example

/** * Executes the current selector on the given matches * * @param Matches $matches Matches * * @return Matches */
    public function exec(Matches $matches)
    {
        $retMatches = array();
        foreach ($this->groups as $group) {
            $clonedMatches = $matches->createClone();
            $group->exec($clonedMatches);
            $retMatches[] = $clonedMatches;
        }
        if (count($retMatches) > 1) {
            $retMatches[0]->merge(array_slice($retMatches, 1));
        }
        return $retMatches[0];
    }
}
Home | Imprint | This part of the site doesn't use cookies.