Home > Backend Development > PHP Tutorial > When calling a recursive function in a loop, is the nested number 100 cumulative?

When calling a recursive function in a loop, is the nested number 100 cumulative?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2023-03-02 06:52:01
Original
1012 people have browsed it

I have a foreach function that calls a recursive function to obtain a subset. There are 36 records in total. When I get to the 16th record, I get an error

<code>Maximum function nesting level of '100' reached, aborting! in </code>
Copy after login
Copy after login

This shouldn’t be an endless loop, right?

When calling a recursive function in a loop, is the nested number 100 cumulative?

When calling a recursive function in a loop, is the nested number 100 cumulative?

Code pictures

Reply content:

I have a foreach function that calls a recursive function to obtain a subset. There are 36 records in total. When I get to the 16th record, I get an error

<code>Maximum function nesting level of '100' reached, aborting! in </code>
Copy after login
Copy after login

This shouldn’t be an endless loop, right?

When calling a recursive function in a loop, is the nested number 100 cumulative?

When calling a recursive function in a loop, is the nested number 100 cumulative?

Code pictures

This is the limit of the entire call stack. You can call the debug_backtrace method to get the current stack depth

http://php.net/manual/en/func...

<code>function test() {
    echo count(debug_backtrace()) . "\n";
}

function test2() {
    test();
}

test(); //输出1
test2(); //输出2
</code>
Copy after login
Related labels:
php
Statement of this Website
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template