码迷,mamicode.com
首页 > 编程语言 > 详细

PHP 数组current和next用法

时间:2015-03-04 15:55:36      阅读:118      评论:0      收藏:0      [点我收藏+]

标签:

 

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用法

标签:

原文地址:http://www.cnblogs.com/zgaspnet/p/4313338.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!