<?php
$xml = '<responseLeg>
<airline airlineCode="US" airlineName="US Airways" />
<flightNumber>6974</flightNumber>
<equipments>Airbus Industrie A318/A319/320/321</equipments>
<departure date="2006-04-11-08:00" location="LAX" time="16:28:00-08:00" />
<arrival date="2006-04-11-08:00" location="LAS" time="17:40:00-08:00" />
<cabinType>Economy</cabinType>
</responseLeg>';
$xml_array = simplexml_load_string($xml);
foreach($xml_array->departure as $departures){
echo "departure: " . date('M d Y h:ia',strtotime(substr($departures['date'],0,10) . ' ' . substr($departures['time'],0,8))) . '<br />';
}
foreach($xml_array->arrival as $arrival){
echo "arrival: " . date('M d Y h:ia',strtotime(substr($arrival['date'],0,10) . ' ' . substr($arrival['time'],0,8))) . '<br />';
}
?>
|