current()函数返回数组中当前指针所在位置的数组值。其形式如下:
mixed current(array array)
下面修改前面的例子,这一次我们要获取数组值:
$fruits = array("apple"=>"red", "banana"=>"yellow");
while ($fruit = current($fruits)) {
printf("%s <br />", $fruit);
next($fruits);
}
//输出如下
// red
// yellow