Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 计算整数数组的所有升序数组_Php_Arrays_Int - Fatal编程技术网

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重置