1

I have an array with the values of nearly 11000 values.

array=(1,2,3..............................., 11000)

when i try iterate the array using foreach, it terminates execution on 9749th item and remaining not executed. Kindly let me know what is the issue to stop the execution inside the loop?.

Note: I didn't use any break or die inside the loop.

Ravichandran Jothi
  • 3,028
  • 11
  • 52
  • 82

1 Answers1

0

Firstly, you should enable displaying PHP errors because PHP will tell you what the issue is. The 3 most common reasons for your execution halting are:

  • max_execution_time - This sets the maximum time in seconds a script is allowed to run before it is terminated by the parser (default: 30 seconds).

  • memory_limit - This sets the maximum amount of memory in bytes that a script is allowed to allocate. If you hit this limit, execution will halt.

  • xdebug.max_nesting_level - If you have xdebug enabled, and are using recursive functions, execution will halt when you hit the nested functions limit (default: 256).

Community
  • 1
  • 1
beardedlinuxgeek
  • 1,652
  • 16
  • 26
  • Actually i increased all those except xdebug.it runs for 2000 array of values. for those the page is loading fine. But for 10000 it display blank page. there is no error message at all even though i added code error enabling codes. – Ravichandran Jothi Jul 27 '16 at 10:51
  • Are you sure you enabled errors? Write some bad code and see if errors appear. Or you can just check the php error log file directly. – beardedlinuxgeek Jul 27 '16 at 11:14
  • @ beardedlinuxgeek yes i got memory exahusted error. – Ravichandran Jothi Aug 02 '16 at 09:16