Home > Backend Development > PHP Tutorial > 怎样检测数组里数据为连续的3位数? (给点意见吧.)解决方法

怎样检测数组里数据为连续的3位数? (给点意见吧.)解决方法

WBOY
Release: 2016-06-13 10:20:10
Original
948 people have browsed it

怎样检测数组里数据为连续的3位数? (给点意见吧..)
怎样检测数组里数据为连续的3位数?



------解决方案--------------------

PHP code
$arr = array(4,7,0,2,4,5,6,9,1,2,3,4);$counter = 1;for($i = 0; $i 找到连续值的数字:\n[".($i - 1)."]=>{$arr[$i - 1]}\n[".$i."]=>{$arr[$i]}\n[".($i + 1)."]=>{$arr[$i + 1]}\n
Copy after login
"; } } else $counter = 1;}
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template