Home >Backend Development >PHP Tutorial > 已知数组中每个值长度相同,怎么增加一个key键呢

已知数组中每个值长度相同,怎么增加一个key键呢

WBOY
WBOYOriginal
2016-06-13 12:33:26847browse

已知数组中每个值长度相同,如何增加一个key键呢?
array
(
 x=> array(0,01,02,...0x),
 y=> array(0,11,12,...1x),
 ...
 n=> array(0,n1,n2,...nx),
)
已知该数组中每个值的长度都是相同的,如:array[x]和array[y]两个数组的长度相等

我想再添加2个键array[a]和array[b],变成
array
(
 x=> array(0,01,02,...0x),
 y=> array(0,11,12,...1x),
 ...
 n=> array(0,n1,n2,...nx),

 a=> array(a,a,a,...b),
 b=> array(b,b,b,...b),
)
有什么好的方法吗

(我现在只想到 先获取到所有的keys,然后再获取第1个key的值长度。然后再填充array[a]和array[b])

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn