|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 Patchesfix_recursive_function (last revision 2011-04-19 00:21 UTC by paridin at paridin dot com)Pull RequestsHistoryAllCommentsChangesGit/SVN commits              [2011-04-19 02:58 UTC] dtajchreber@php.net
 
-Status: Open
+Status: Bogus
  [2011-04-19 02:58 UTC] dtajchreber@php.net
  [2011-04-19 05:08 UTC] paridin at paridin dot com
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 11:00:01 2025 UTC | 
Description: ------------ When you try to make recursive function and send the counter directly. you have an error, to fix this, you need increment before the counter, and after send this counter. Test script: --------------- <?php function foo($i){ if( $i < 100){ echo " ".$i; return foo($i++); // bug }else{ return $m="\r\nEnd Process"; } } $i=0; echo foo($i); ?> Expected result: ---------------- 1 2 3 4 5 6 7 8 ... 97 98 99 100 End Process Actual result: -------------- 00000...0000000 Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 523800 bytes) in /home/paridin/public_html/bug.php on line 5