Php 计算整数数组的所有升序数组
我有一个问题:“计算整数数组的所有升序数组” 我的代码:Php 计算整数数组的所有升序数组,php,arrays,int,Php,Arrays,Int,我有一个问题:“计算整数数组的所有升序数组” 我的代码: <?php $arrInt = array(1, 2, 3, 4, 5, 1, 2); function numArrChildAscending($index, $indexcount, $array = array()){ $numcount = 0; if ($index >= count($array) || $index < 1 || $index + $indexcount >= c
<?php
$arrInt = array(1, 2, 3, 4, 5, 1, 2);
function numArrChildAscending($index, $indexcount, $array = array()){
$numcount = 0;
if ($index >= count($array) || $index < 1 || $index + $indexcount >= count($array)){
return $numcount;
}
$flag = true;
for ($i = $index; $i <= ($index + $indexcount - 1); $i++){
if ($array[$i] <= $array[$i - 1]){
$flag = false;
break;
}
}
if ($flag == true){
$numcount++;
}
//echo 'count 1 :' . $numcount . '<br />';
for ($i = $index + 1; $i < count($array); $i++){
$numcount = $numcount + numArrChildAscending($i, $indexcount, $array);
}
//echo 'count 2 :' . $numcount . '<br />';
for ($i = $indexcount; $i < count($array); $i++) {
$numcount = $numcount + numArrChildAscending($index, $i, $array);
}
//echo 'count 3 :' . $numcount . '<br />';
return $numcount;
}
echo numArrChildAscending(1, 2, $arrInt);
Fatal error: Maximum function nesting level of '256' reached, aborting!
in D:\VertrigoServ\www\learningphp.vn\index.php on line 7
编辑
php.ini
文件:在xdebug部分中搜索xdebug.max\u nesting\u level
。增加值。将这一行放在php文件中
ini_set('xdebug.max_nesting_level', $limit)
确保您已经安装了xdebug我在php.ini文件中找不到它,我下载了它,并将它移动到了哪里?我设置了ini\u集('xdebug.max\u nesting\u level',2000)代码>和错误连接\u重置