How do I declare a two dimensional array?

前端 未结 14 1567
爱一瞬间的悲伤
爱一瞬间的悲伤 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:57

    You need to declare an array in another array.

    $arr = array(array(content), array(content));

    Example:

    $arr = array(array(1,2,3), array(4,5,6));

    To get the first item from the array, you'll use $arr[0][0], that's like the first item from the first array from the array. $arr[1][0] will return the first item from the second array from the array.

提交回复
热议问题