I am reading an xml file using php, after reading those files i am accessing some values and comparing them here is the code for that:
$home = $match -> home -> name;
$away = $match -> away -> name;
$homescore = $match -> home -> shoots;
$awayscore = $match -> away -> shoots;
if($home == 'Lakers' || $away == 'Lakers') {
$played = $played+1;
if($home == 'Lakers') {
echo $homescore;
echo $awayscore;
if($homescore > $awayscore) {
echo 'hi';
}
}
}
As it can be seen from the code above, i am reading in the name and shoots of a team. When i execute this the returned result is 63. Now 6 is the $homescore 3 is the $awayscore. Based on these values i am expecting that it should also print hi. But for some reason i am not getting the desired output.
Anyone able to see if i am doing something wrong here?
Replace your ‘innest’ if statement with this code: