你可以使用我的功能 的 printMyArray($阵列) 强> 用键打印你的数组。
<?php $array=array( 'test1' => 'firstvalue', 'test2' => 'secondvalue' ); printMyArray($array); function printMyArray ($array) { while ($val = current($array)) { echo key($array).' '.$val.'<br>'; next($array); } } ?>
就像for循环可以转换为while循环一样,foreach循环可以像这样转换为while循环。
的 编辑: 强> 您尚未正确实现它。你不能使用 的 getVehicleValuation() 强> 就像在循环中那样。 将您的代码更改为:
if($parameter['aktion'] == 'login') { $returned_array=getVehicleValuation(); while ($val = current($returned_array)) { echo key($returned_array).' '.$val.'<br>'; next($returned_array); } }