note 48032 deleted from function.xml-parse-into-struct by sobak
| From: | sobak@php.net | Date: | Sat, 10 Dec 2016 23:29:33 +0000 |
| Subject: | note 48032 deleted from function.xml-parse-into-struct by sobak | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-208470@lists.php.net to get a copy of this message | ||
Note Submitter: memandeemail at gmail dot com
----
a BREAK on right place, will be faster and bugprevent
/**
* @return bool
* @param xml_array $values
* @param xml_array[reference] $tags
* @desc Reconstruct xml_parse_into_struct to open and close concept
*/
function reconstruct_tag($values, &$tags) {
unset($return);
foreach ($tags as $tkey => $tvalue) {
foreach ($tvalue as $vvalue) {
if ($values[$vvalue]['type'] == 'open' or $values[$vvalue]['type']
== 'complete') {
$return[$tkey][] = $vvalue;
}
if ($values[$vvalue]['type'] == 'open') {
foreach ($tvalue as $tv_value) {
if ($values[$tv_value]['type'] == 'close'
and $values[$tv_value]['level'] == $values[$vvalue]['level']
and $tv_value > $vvalue) {
$return[$tkey][] = $tv_value;
break;
}
}
}
}
}
$tags = $return;
return (bool) $tags;
}