Hi I have an array created from an XML file using this function.
# LOCATIONS XML HANDLER
#creates array holding values of field selected from XML string $xml
# @param string $xml
# @parm string $field_selection
# return array
#
function locations_xml_handler($xml,$field_selection){
# Init return array
$return = array();
# Load XML file into SimpleXML object
$xml_obj = simplexml_load_string($xml);
# Loop through each location and add data
foreach($xml_obj->LocationsData[0]->Location as $location){
$return[] = array("Name" =>$location ->$field_selection,);
}
# Return array of locations
return $return;
}
How can I stop getting duplicate values or remove from array once created?
$return[] = $location->$field_selection.