PHP uses Array_fill to define a multidimensional array method, Array_fill multidimensional
This example describes how PHP uses Array_fill to define multidimensional arrays. Share to everyone for your reference. The specific analysis is as follows:
Multiple Array_fill can be nested in PHP to complete the definition of a multidimensional array:
$creation =array_fill (0,3,array_fill (0,2,null));
The following statements can be used to populate:
$abc =0;for ($i =0; $i <3; $i + +) {for ($j =0; $j <2; $j + +) {$abc = $abc +1; $creation [$i] [$j]= $abc;}}
The result is:
Array ([0] = = Array ([0] = 1 [1] = 2) [1] = = Array ([0] = = 3 [1] = 4) [2] = = Array ([0] = = 5 [1] = 6))
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/969481.html www.bkjia.com true http://www.bkjia.com/PHPjc/969481.html techarticle PHP uses Array_fill to define a multidimensional array method, Array_fill multidimensional This article describes how PHP uses Array_fill to define multidimensional arrays. Share to everyone for your reference. A specific analysis such as ...