Hello,
I am parsing an XML file using this great XML2Array script by "MA Razzaque Rupom", however when it puts the xml into an array if <results> has one result it looks like this:
[Results] => Array
(
[Code] => ABCD
[Description] => Example 1
[Rated] => 99
)
If <results> has several results it looks like this:
[Results] => Array
(
[0] => Array
(
[Code] => efg
[Description] => Example 2
[Rated] => 44
)
[1] => Array
(
[Code] => hijk
[Description] => Example 3
[Rated] => 66
)
)
The problem I have is when I go to do a foreach
foreach ($Results as $i){
$Discription = $i[Description];
print "Discription: $Discription<br>";
}
on the single result it prints
A
E
9
On the multiple result it prints:
Example 1
Example 2
Example 3
How do I check to see if it a multiple or a single result and then format it so that the foreach will work in either case?
Chris