Home  >  Article  >  php教程  >  php数组比较实现查找连续数的方法

php数组比较实现查找连续数的方法

WBOY
WBOYOriginal
2016-06-06 19:50:031095browse

这篇文章主要介绍了php数组比较实现查找连续数的方法,实例分析了php数组查找及字符串操作的相关技巧,需要的朋友可以参考下

本文实例讲述了php数组比较实现查找连续数的方法。分享给大家供大家参考。具体如下:

$data = array(); $data[]= array("01" ,"02", "18" , "29" , "31" , "32"); $data[]= array("02" ,"09", "11" , "22" , "24" , "27"); $data[]= array("07" ,"16", "26" , "27" , "29" , "31"); $data[]=array("04", "05", "07", "10", "13", "25"); $data[]=array("02", "04", "05", "08", "19", "22"); $data[]=array("03", "04", "15", "25", "26", "30"); $data[]=array("01", "03", "06", "12", "16", "32"); $data[]=array("01", "05", "14", "17", "22"); // 判断表格中3个以上的连续 function checkAll($sourceArr2D) { $count = sizeof($sourceArr2D); for($i=0; $i0) { check_v($sourceArr2D, $i);// 找寻竖直方向 check_l($sourceArr2D, $i);// 找寻/方向 check_r($sourceArr2D, $i);// 找寻方向 } } } // 判断水平方向 $h = array();// 保存水平方向上的搜寻结果 function check_h($arr, $rownum) { //sort($arr, SORT_NUMERIC); global $h; $flag = false; for($i=2; $i

希望本文所述对大家的php程序设计有所帮助。

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