When I Do an IF Statement using PHP while checking values from an XML File, It thinks that the statement is not true although it is..
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<TacviewDebriefing Version="1.2.6">
<Mission>
<Title>TAPE0003</Title>
<MissionTime>2015-06-03T00:00:00Z</MissionTime>
<Duration>32890.02</Duration>
<MainAircraftID>59</MainAircraftID>
</Mission>
<Events>
<Event>
<Time>32224.76</Time>
<PrimaryObject ID="59">
<Type>Aircraft</Type>
<Name>F-16C Fighting Falcon</Name>
<Pilot>Viper</Pilot>
<Coalition>ROK/Shark</Coalition>
</PrimaryObject>
<Action>HasTakeOff</Action>
<Airport ID="ICAO:LLHS">
<Name>Hatzor AFB</Name>
</Airport>
</Event>
</Events>
</TacviewDebriefing>
and that the sample of my code:
$xml = simplexml_load_file($filedir) or die("Error: Could not open file<br>");
if(isset($xml->Mission)){
foreach($xml->Events->Event as $value){
$num++;
if($xml->Mission->MainAircraftID === $value->PrimaryObject['ID']{
echo $value->Action;
}
}
}
P.S: If i try to echo $value->PrimaryObject['ID'];
and echo $xml->Mission->MainAircraftID; (Inside the foreach loop)
it prints 59 and 59...