We know that each value in the array has the same length. how can we add a key? Array (& nbsp; x = & gt; & nbsp; array (0, 01, 02 ,... 0x), & nbsp; y = & gt; & nbsp; array (0, 11, 12 ,... 1x), & nbsp ;... we know that each value in the array has the same length. how can we add a key?
Array
(
X => array (0, 01, 02,... 0x ),
Y => array (0, 11, 12,... 1x ),
...
N => array (0, n1, n2,... nx ),
)
It is known that the length of each value in the array is the same, for example, the length of the array [x] and array [y] are equal.
I want to add two more keys, array [a] and array [B],
Array
(
X => array (0, 01, 02,... 0x ),
Y => array (0, 11, 12,... 1x ),
...
N => array (0, n1, n2,... nx ),
A => array (a,... B ),
B => array (B,... B ),
)
Is there any good method?
(Now I only want to get all the keys first, and then get the length of 1st keys. Then fill in array [a] and array [B]) to share :? Array (0, 01, 02,... 0x ),? Y =>? Array (, 12,... 1x ),?...? N =>? Array (0, n1, n2,... nx)... 'data-pics = ''>
------ Solution --------------------
$ Ar = your array;
$ C = count ($ ar ['x']);
$ Ar ['A'] = array_fill (0, $ c, "");
Print_r ($ ar );