我的代码如下的foreach循环:复制输出错误
$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>";
}
}
,这让我输出这样的 -
93 :: 1
93 :: 2
355 :: 1
355 :: 2
355 :: 1
355 :: 2
213 :: 1
213 :: 2
213 :: 1
213 :: 2
213 :: 1
213 :: 2
其实我期待输出这样的 -
93 :: 1
93 :: 2
355 :: 1
355 :: 2
213 :: 1
213 :: 2
尝试了很多以获得该输出,但没有成功。我错过了什么地方?
您可能错过了“GetServiceProviders'通过引用*接受其第一个参数*的部分,并向其中添加了两个项目。如果没有,你的代码不会给任何*输出。 – Jon 2012-04-17 10:34:54
是的,它通过引用接受,并且代码确实给出了输出结果。 – skos 2012-04-17 10:37:21