My code is as follows
$aNewCodes = array("93", "355", "213");
$aServiceProviderId = array();
$oTerminationRate = new TerminationRate();
foreach ($aNewCodes as $iNewCodesKey => $iNewCodesValue)
{
$oTerminationRate->GetServiceProviders($aServiceProviderId, $iNewCodesValue);
foreach($aServiceProviderId as $iProviderKey => $iProviderValue)
{
echo $iNewCodesValue." :: ".$iProviderValue."<br>";
}
}
And it gives me output like this –
93 :: 1
93 :: 2
355 :: 1
355 :: 2
355 :: 1
355 :: 2
213 :: 1
213 :: 2
213 :: 1
213 :: 2
213 :: 1
213 :: 2
Actually I am expecting output like this –
93 :: 1
93 :: 2
355 :: 1
355 :: 2
213 :: 1
213 :: 2
Tried a lot to get that output, but no success. Where am I missing out ?
Your problem is that you are not deleting previous entries from the
aServiceProviderIdarray on each iteration of the loop. Put lineinside the first loop – right before
And you should be ok.