Home >Backend Development >PHP Tutorial >请问怎么创建一个二维数组

请问怎么创建一个二维数组

WBOY
WBOYOriginal
2016-06-13 11:17:501105browse

请教如何创建一个二维数组?
已知一个while循环里面会产生n个一维数组:
while(循环n次){
    $arr = array(...);//产生一个一维数组
}

那如何把这n个一维数组放到 一个数组里面?

二维数组
------解决方案--------------------
看一下array_push()和array_merge()方法
http://www.w3schools.com/php/php_ref_array.asp
------解决方案--------------------
while(循环n次){
    $arr[] = array(...);//产生一个一维数组
}
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