Problem using recursive functions on tp3.2, please help me
phpcn_u1546
phpcn_u1546 2017-08-27 16:22:13
0
1
1112

111.png222.png

The left side of the picture is the code, and the right side is the running result. I execute the aaa() function, which executes the kissom() function three times, but why are the results printed the second and third times the same, and there is only one line? It should be a static problem. When executing the second and third times, $ count is updated. But this function can be executed if it is not placed in tp, but cannot be executed in the tp framework. Is there anyone who can give me some guidance?

phpcn_u1546
phpcn_u1546

reply all(1)
phpcn_u1546

Modify it, I changed the above if condition to $count<5, I forgot about it. Is there a great god?

  • reply After you execute kissom for the first time in the aaa method, $count finally equals 4. Because your if condition is <5, it will not run if it equals 5, so the next two calls are both 5.
    ringa_lee author 2017-08-27 22:41:38
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template