I have a little PHP script I am running.
It basically puts the content of an XML file and assigns it to a variable.
I then create an array containing all the XML tags and values I want to use, using the parse array function from LIB_parse.php:
function parse_array($string, $beg_tag, $close_tag)
{
preg_match_all("($beg_tag(.*)$close_tag)siU", $string, $matching_data);
//preg_match_all("($beg_tag(.*)($beg_tag(.*)$close_tag)+(.*)$close_tag)siU", $string, $matching_data);
return $matching_data[0];
}
This all works well.
But what I would like to do is remove all duplicates from this now huge array.
I have done it through Excel and I know it should give me 3945 XML tags and values.
But when I run the array through array_unique, it returns me an array with 3945 lines but only about 400 of them actually contain the XML tags and values I want, the others are blank lines.
$value = file_get_contents("myXMLfile.xml");
$array = parse_array($value, "<marker", "/>");
$clean_array = array_unique($array);
I then use a loop to put the values of the array into another XML file.
Any ideas?
Sorry the length of this.