We know that each value in the array has the same length. how can we add a key?

Source: Internet
Author: User
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 );
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.