xml - PHP array_unique not behaving as expected -
i have little php script running.
puts content of xml file , assigns variable.
create array containing xml tags , values want use, using parse array function 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 works well.
but remove duplicates huge array.
have done through excel , know should give me 3945 xml tags , values.
when run array through array_unique, returns me array 3945 lines 400 of them contain xml tags , values want, others blank lines.
$value = file_get_contents("myxmlfile.xml"); $array = parse_array($value, "<marker", "/>"); $clean_array = array_unique($array);
i use loop put values of array xml file.
any ideas?
sorry length of this.
Comments
Post a Comment