时间:2021-07-01 10:21:17 帮助过:1人阅读
1.current
<?php $transport = array('foot', 'bike', 'car', 'plane'); $mode = current($transport); //$mode = 'foot'; $mode = next($transport); // $mode ='bike'; $mode = current($transport); //$mode = 'bike'; $mode = prev($transport); // $mode ='foot'; $mode = end($transport); // $mode ='plane'; $mode = current($transport); //$mode = 'plane'; ?>
2.next
<?php $transport = array('foot', 'bike', 'car', 'plane'); $mode = current($transport); //$mode = 'foot'; $mode = next($transport); // $mode ='bike'; $mode = next($transport); // $mode ='car'; $mode = prev($transport); // $mode ='bike'; $mode = end($transport); // $mode ='plane'; ?>
示例很简单,但是却很实用,希望小伙伴们能够喜欢。
以上就介绍了PHP 数组current和next用法分享,包括了current,next方面的内容,希望对PHP教程有兴趣的朋友有所帮助。