search

Home  >  Q&A  >  body text

How many levels of cyclic arrays can php handle?

is foreach nested inside foreach. I tried the third layer but it didn’t work. It’s so slow. How do the masters handle this situation?

代码输入中...代码输入中...2695 days ago1667

reply all(2)I'll reply

  • PHP中文网

    PHP中文网2017-08-23 11:52:02

    Theoretically unlimited, but most projects will only use three layers

    reply
    0
  • ringa_lee

    ringa_lee2017-08-21 17:44:10

    Generally speaking, there are at most three levels of loops. It is not recommended to use more than one. PHP is not good at processing such data. You can change your thinking and use other methods to process it

    reply
    0
  • Cancelreply