动态数组是如何创建的

WBOY
Release: 2016-06-13 13:37:42
Original
1056 people have browsed it

动态数组是怎么创建的?

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
$theTBHead = array();//这个不是很理解,没有指定长度能添加数据吗?
while($row2 = mysql_fetch_array($sql2))
{
    //这里希望将$row2["nChinese"]字段依次存储到$theTBHead的每个元素中,
    //而且希望元素脚标是递增编号的(0,1,2,3...这样的脚标),应该怎么写呀?
}


Copy after login


------解决方案--------------------
$theTBHead = array();

于是 $theTBHead 是一个空的数组

php 的数组并不是数学意义上的数组,只是使用了这个名字
他实际上是一个结构、一个链表
------解决方案--------------------
array_push($theTBHead,$row2["nChinese"]);
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!