假设我有这个数组:
$cars = array("Saab","Volvo","BMW","Toyota");
我也有这个 Foreach 循环来“操纵”那个数组:
foreach ($cars as $carsdata)
{
if (*this is array[0]) {
do something here
}else if (*array[1] ... array[x]){
do another thing here
}
}
知道如何正确编写 Foreach 吗?谢谢。