还是一个新手问题 在给定的字符数组中找出连续最长的数字串,并把这个串的长度返回 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 老大果然热心!!假设是数组a吧,$a=array('27845615','47234567','78786781','60175123') $a=array('27845615','47234567','78786781','60175123');foreach($a as $v) { echo fountMax($v). '<br/>';}/*3633*/function fountMax($str){ $arr = str_split($str); $max = 1; $tmp = 1; for($i=1; $i<count($arr); $i++) { if($arr[$i-1]+1 == $arr[$i]) { $tmp++; $max = $tmp>$max ? $tmp : $max; } else { $tmp = 1; } } return $max;} 用curl抓取网页的时候,为什么我的每次都只能抓取18个左右就自动停止了? RewriteRule规则谁会?帮我看下第2条为什么无效?怎么写才可以? 字符串输出问题 PHP中时局库的查询与显示问题,望高手帮忙!谢谢先~ php 读配置文件 请问可不可以在提交该页面之后…………? 是太难了还是太简单了,帮我看看吧 各位大师。高难问题。。进者给分。。。。 关于__set的问题 新手求助!! php中的float和double有哪些区别?感觉很迷茫。 递归算法
$a=array('27845615','47234567','78786781','60175123');foreach($a as $v) {
echo fountMax($v). '<br/>';
}/*3
6
3
3*/
function fountMax($str)
{
$arr = str_split($str);
$max = 1;
$tmp = 1;
for($i=1; $i<count($arr); $i++) {
if($arr[$i-1]+1 == $arr[$i]) {
$tmp++;
$max = $tmp>$max ? $tmp : $max;
}
else {
$tmp = 1;
}
}
return $max;
}