Hi Guys,
I have an xml document wich I can view as xml or put into an array. I need to parse the xml data to find the minimum SLevel value, displaying on the page that value itself and the company offering it. I have tried in vain to get it working. I can find data by looping through matching a company name or exact value.
foreach ($xml->Type->Company as $item)
{
if ($item->SLevel == 18.56)
{
do here
}
But ,I have no idea how to loop through using min to find the lowest number. Would anyone have a working example I could follow. Many thanks. Jon
<Quotes>
<Type>
<Desc>Life Cover Only</Desc>
<CriticalWarning>For Friends First, conversion applies to life and Specified Illness to age 65.</CriticalWarning>
<Company>
<Name key="1">Caledonian Life</Name>
<PricePledge>True</PricePledge>
<Underwriting1/>
<SLevel key="2">23.98</SLevel>
<SConvertible key="2">25.51</SConvertible>
<SMortgage key="2">18.66</SMortgage>
<SConvMortgage key="0">-</SConvMortgage>
</Company>
<Company>
<Name key="2">Canada Life</Name>
<PricePledge>False</PricePledge>
<Underwriting1/>
<SLevel key="0">-</SLevel>
<SConvertible key="0">-</SConvertible>
<SMortgage key="0">-</SMortgage>
<SConvMortgage key="0">-</SConvMortgage>
</Company>
</Type>
</Quotes>