I am extremely rusty on my php. I am working with an API and in the response it returns a
Rates array object.
The
Rates object is an array holding
Rate(s) which each hold information such as
Amount and
PackageType. I am trying to save the
Rate object which has
Amount=x and
PackageType=y.
This code outputs what I want to see, but it is not at all what I want to program.
Code
foreach($Rates as $key => $value)
{
echo $value[0]->Amount . "===" . $value[0]->PackageType;
echo $value[1]->Amount . "===" . $value[1]->PackageType;
echo $value[2]->Amount . "===" . $value[2]->PackageType;
}
This is the pseudo-code for what I need in php:
Code
for($i=0;$Rates;$i++)
{
$Rate = $Rates[$i];
if($Rate->Amount == x && $Rate->PackageType == y)
{
return $Rate;
}
}
Thanks for helping out a noob...