手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >PHP 数组current和next用法分享
PHP 数组current和next用法分享
摘要:1.current复制代码代码如下:2.next复制代码代码如下:示例很简单,但是却很实用,希望小伙伴们能够喜欢。

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用法分享】相关文章:

JQuery中attr方法和removeAttr方法用法实例

jquery中map函数遍历数组用法实例

JQuery中Text方法用法实例分析

Ctrl+Enter提交内容信息

JavaScript中继承用法实例分析

javascript常用方法总结

javascript获取select值的方法分析

Javascript中For In语句用法实例

javascript常用的方法分享

javascript中attachEvent用法

精品推荐
分类导航