How do I declare a two dimensional array?

前端 未结 14 1590
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-29 21:46

What\'s the easiest way to create a 2d array. I was hoping to be able to do something similar to this:

declare int d[0..m, 0..n]
14条回答
  •  伪装坚强ぢ
    2020-11-29 21:53

    For a simple, "fill as you go" kind of solution:

    $foo = array(array());

    This will get you a flexible pseudo two dimensional array that can hold $foo[n][n] where n <= ∞ (of course your limited by the usual constraints of memory size, but you get the idea I hope). This could, in theory, be extended to create as many sub arrays as you need.

提交回复
热议问题