break up recursive function in php

Posted by Mike on Stack Overflow See other posts from Stack Overflow or by Mike
Published on 2011-01-09T02:59:16Z Indexed on 2011/01/09 11:53 UTC
Read the original article Hit count: 152

Filed under:

What is the best way to break up a recursive function that is using a ton of resources

For example:

function do_a_lot(){

   //a lot of code and processing is done here
   //it takes a lot of execution time

   if($true){

      //if true we have to do all of that processing again
      do_a_lot();

   }

}

Is there anyway to make the server only have to take the brunt of the first execution and then break up the recursion into separate processes? Or am I dreaming?

© Stack Overflow or respective owner

Related posts about php