3

I was working on a function, that ends up adding a massive amounts of dimensions to an array, and I was wondering, is it possible to reach a limit on how many dimensions can be added, and if so, what is that limit in PHP?

Zul
  • 3,627
  • 3
  • 21
  • 35
Scott Flack
  • 600
  • 7
  • 12
  • If you have to ask, you're probably adding too many things into the array. :o) I don't think there's a limit though, apart from the raw physical memory the machine has. – deceze Feb 01 '12 at 00:46
  • Depends how much memory you've got ;) – Abe Petrillo Feb 01 '12 at 00:47
  • http://stackoverflow.com/questions/467149/what-is-the-max-key-size-for-an-array-in-php – Zul Feb 01 '12 at 00:53

1 Answers1

2

No, I don't believe there's a limit to the depth of access (save for how much RAM you've got).

Each level adds at least one pointer indirection, though, so the speed of retrieving elements will suffer as you get deeper.

I'd be willing to bet dollars to donuts there's an easier way to store and manipulate the data you think you need this super-array for.

Borealid
  • 95,191
  • 9
  • 106
  • 122