后端开发|php教程
this,gt,steps,function,39
后端开发-php教程
PHP 获取数组任意下标key的上一个prev和下一个next下标值
手游脚本源码,vscode 选中文字加框,ubuntu 美化 字体,多个tomcat管理启动,爬虫安装教程,php接口调用方法,无锡做seo优化公司哪家好lzw
PHP 获取数组任意下标key的上一个prev和下一个next下标值
搭建云购网站源码,ubuntu安装GCC图解,学爬虫难吗,< php空格,徐福 seo booklzw
大灌篮源码,vscode图片提示插件,ubuntu 装在,tomcat站点配置,sqlite3管理工具,京东网页设计教程,在线mysql数据库,什么是服务器租用,zepto scroll 插件,跨平台前端框架,python爬虫书籍推荐,php 开方,南宁seo优化公司,网关 springboot,为什么要调用织梦标签,php软件网站源码,网页源文件下载器,卡盟首页模板代码,如何在百度推广后台查看访客ip,html页面报表表格,政府管理系统,最小二乘法直线拟合程序lzw
$value){$steps->add($key);}$steps->setCurrent(3);//参数为key值echo 上一个下标:.$steps->getPrev()."
";echo 指定的下标:.$steps->getCurrent()."
";echo 下一个下标:.$steps->getNext()."
";class Steps {private $all; private $count; private $curr;function __construct() { $this->count = 0; } function add($step) { $this->count++; $this->all[$this->count] = $step; } function setCurrent($step) { reset($this->all); for ($i = 1; $i count; $i++) { if ($this->all[$i] == $step)break; next($this->all); } $this->curr = current($this->all); } function getCurrent() { return $this->curr; } function getNext() { self::setCurrent($this->curr); return next($this->all); } function getPrev() { self::setCurrent($this->curr); return prev($this->all); }}
打印结果:
上一个下标:2指定的下标:3下一个下标:4