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

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

WBOY
WBOYOriginal
2016-06-13 13:33:28818browse

怎样检测数组里数据为连续的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
"; } } else $counter = 1; }
Statement:
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