function _getElementByTagName($tree, $TagName, &$vector) { if ($tree['TagName'] == $TagName) { array_push($vector, $tree); } $total = count($tree['children']); for ($i = 0; $i < $total; $i++) { XML::_getElementByTagName($tree['children'][$i], $TagName, $vector); } }