PHP中的next()函数
该next()函数将数组的内部数组指针前进到下一个元素。
语法
next(arr)
参数
arr-指定的数组
返回
如果next()成功,该函数将返回数组中下一个元素的值。如果没有更多可用元素,则返回FALSE。
示例
以下是一个例子-
<?php
$os = array('windows', 'mac', 'linux', 'solaris');
echo current($os) . "<br>";
echo next($os);
?>输出结果
windows mac
示例
让我们看另一个例子-
<?php
$a = array('one', 'two', 'three', 'four', 'five', 'six' );
echo current($a)."\n";
echo next($a)."\n";
echo current($a)."\n";
echo next($a)."\n";
echo end($a)."\n";
echo current($a)."\n";
?>输出结果
one two two three six six
热门推荐
1 狗狗技能训练
5 如何训练狗狗笑
6 狗狗训练排便
9 狗狗响片训练
10 如何训练狗狗不捡食
11 狗狗尿训练
12 怎么训练狗狗找东西
13 狗狗训练站立
14 狗狗训练飞盘
15 鞍山狗狗训练
16 怎样训练泰迪狗狗谢谢
17 狗狗外出训练
18 怎么训练金毛狗狗大小便