Hi Sitepointers,

I am trying to get unique items into an array from an XML file.

However my code is puching every item into the array, Where am I going wrong?

Many thanks

PHP Code:
<?php

$xml 
simplexml_load_file('mercers.xml');

$property_distinct_beds = array();
foreach(
$xml->property as $property) {
    
$property_bedrooms $property->beds;
    if (!
in_array($property_bedrooms$property_distinct_bedsTRUE)) {
        
array_push($property_distinct_beds$property_bedrooms);
    }
}


foreach (
$property_distinct_beds as $distinct_beds) {
    echo 
$distinct_beds.'<br />';
}

?>
The files are located:
http://www.spanishproperty.es/mobile/xml_test.php
http://www.spanishproperty.es/mobile/mercers.xml