Notices
Results 1 to 8 of 8

Thread: Recursion in PHP

  1. #1 Recursion in PHP 
    New Member
    Join Date
    Aug 2005
    Posts
    4
    I'm writing an interpreter for a simple functional programming language of my design. If you've ever used functional programming languages, you know that they use recursion quite frequently, and often the recursion goes rather deep. PHP's call stack is simply not doing the job: stack crashes are happening too often to be tolerable. I know there's no way to make the call stack any bigger, so is there some way I could somehow circumvent it? Some way to maybe simulate recursion without actually making recursive function calls? I'm at a loss here, and I'd appreciate any ideas anyone might have.


    Reply With Quote  
     

  2.  
     

  3. #2  
    Forum Isotope (In)Sanity's Avatar
    Join Date
    Oct 2004
    Location
    Mesa AZ
    Posts
    2,699
    What version of PHP are you using? How much memory did you give it?


    Reply With Quote  
     

  4. #3  
    New Member
    Join Date
    Aug 2005
    Posts
    4
    I'm using PHP 4.3.10. I don't know how much memory it has because I don't have direct access to the server.
    Reply With Quote  
     

  5. #4  
    Forum Isotope (In)Sanity's Avatar
    Join Date
    Oct 2004
    Location
    Mesa AZ
    Posts
    2,699
    Run phpinfo()

    Better yet post a link so I can see the PHP info. I think the norm if they have memory limits turned on is 8 MB. This server has no memory limit on PHP. For a normal shared server it's a very good idea to enforce one, so I suspect this may be your problem.
    Reply With Quote  
     

  6. #5  
    New Member
    Join Date
    Aug 2005
    Posts
    4
    Already have. That's where I got the version. Here: http://nicf.net/phpinfo.php
    Reply With Quote  
     

  7. #6  
    Forum Isotope (In)Sanity's Avatar
    Join Date
    Oct 2004
    Location
    Mesa AZ
    Posts
    2,699
    Hmm, doesn't appear they have the memory limits turned on. Not a good idea for a production box.

    What kind of error are you receiving? Be curious to see what it is your doing that is causing such issues.
    Reply With Quote  
     

  8. #7  
    New Member
    Join Date
    Aug 2005
    Posts
    4
    It's a stack crash. The script just stops. No error message.
    Reply With Quote  
     

  9. #8  
    Forum Isotope (In)Sanity's Avatar
    Join Date
    Oct 2004
    Location
    Mesa AZ
    Posts
    2,699
    Quote Originally Posted by DiffyQ
    It's a stack crash. The script just stops. No error message.
    Hmm, I've never had that happen and I've been programming PHP for the last 5 years.
    Reply With Quote  
     

Bookmarks
Bookmarks
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •