<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>风雪之隅 &#187; 数组</title>
	<atom:link href="http://www.laruence.com/tag/%e6%95%b0%e7%bb%84/feed" rel="self" type="application/rss+xml" />
	<link>http://www.laruence.com</link>
	<description>PHP语言, PHP扩展, Zend引擎相关的研究,技术,新闻分享 - 左手代码 右手诗</description>
	<lastBuildDate>Wed, 08 Feb 2012 05:12:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>深入理解PHP之数组(遍历顺序)</title>
		<link>http://www.laruence.com/2009/08/23/1065.html</link>
		<comments>http://www.laruence.com/2009/08/23/1065.html#comments</comments>
		<pubDate>Sun, 23 Aug 2009 03:04:08 +0000</pubDate>
		<dc:creator>雪候鸟</dc:creator>
				<category><![CDATA[PHP应用]]></category>
		<category><![CDATA[PHP源码分析]]></category>
		<category><![CDATA[foreach sequence]]></category>
		<category><![CDATA[foreach顺序]]></category>
		<category><![CDATA[HashTable]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[数组]]></category>

		<guid isPermaLink="false">http://www.laruence.com/?p=1065</guid>
		<description><![CDATA[经常会有人问我, PHP的数组, 如果用foreach来访问, 遍历的顺序是固定的么? 以什么顺序遍历呢?
比如:
<coolcode lang="php" linenum="off">
<?php
$arr[2] = 'huixinchen';
$arr[1]  = 2007;
$arr[0]  = 2008;
foreach ($arr as $key => $val) {
//结果是什么?
}
</coolcode>

要完全了解清楚这个问题, 我想首先应该要大家了解PHP数组的内部实现结构.........]]></description>
			<content:encoded><![CDATA[<div class="copyright" >
<ul  style="padding-left:1em;font-size:85%;padding-left:1em;font-size:85%;">
<li>作者: <a href="http://www.laruence.com" >Laruence</a>(<a href="http://www.twitter.com/laruence"  target="meme"  title="Twitter" ><img src="/images/ico-twitter.png" /></a> <a href="http://t.sina.com/laruence"  target="meme"  title="新浪微博" ><img src="/images/ico-sina.png" /></a> <a href="http://fusion.google.com/add?feedurl=http://www.laruence.com/feed"  target="meme"  title="Google阅读器" ><img src="/images/ico-google.png" /></a> <a href="mailto:laruence@yahoo.com.cn"  target="meme"  title="邮件" ><img src="/images/ico-mail.png" /></a>)</li>
<li>本文地址: <a href="http://www.laruence.com/2009/08/23/1065.html"  title="Permanet Link to 深入理解PHP之数组(遍历顺序)" >http://www.laruence.com/2009/08/23/1065.html</a></li>
</li>
<li>转载请注明出处 </li>
</ul></div>
<p>
经常会有人问我, PHP的数组, 如果用foreach来访问, 遍历的顺序是固定的么? 以什么顺序遍历呢?<br/>
比如:</p>
<pre name="code"  class="sh_php"  linenum="off"   style="background: #333; color: #d9d9d9; border-left: 15px solid #c9c9c9; padding: 9px; font-size: 1em; overflow-x: auto;font-family:Monacobackground: #333; color: #d9d9d9; border-left: 15px solid #c9c9c9; padding: 9px; font-size: 1em; overflow-x: auto;font-family:MonacoConsolasConsolasCourierCouriermonospace;monospace;">
&lt;?php
$arr['laruence'] = 'huixinchen';
$arr['yahoo']    = 2007;
$arr['baidu']    = 2008;
foreach ($arr as $key =&gt; $val) {
//结果是什么?
}
</pre>
<p>又比如:</p>
<pre name="code"  class="sh_php"  linenum="off"   style="background: #333; color: #d9d9d9; border-left: 15px solid #c9c9c9; padding: 9px; font-size: 1em; overflow-x: auto;font-family:Monacobackground: #333; color: #d9d9d9; border-left: 15px solid #c9c9c9; padding: 9px; font-size: 1em; overflow-x: auto;font-family:MonacoConsolasConsolasCourierCouriermonospace;monospace;">
&lt;?php
$arr[2] = 'huixinchen';
$arr[1]  = 2007;
$arr[0]  = 2008;
foreach ($arr as $key =&gt; $val) {
//现在结果又是什么?
}
</pre>
<p>要完全了解清楚这个问题, 我想首先应该要大家了解PHP数组的内部实现结构&#8230;&#8230;&#8230;</p>
<h3>PHP的数组</h3>
<p>在PHP中, 数组是用一种HASH结构(HashTable)来实现的, PHP使用了一些机制, 使得可以在O(1)的时间复杂度下实现数组的增删, 并同时支持线性遍历和随机访问.</p>
<p>之前的文章中也讨论过, <a href="http://www.laruence.com/2009/07/23/994.html"  target="_blank" >PHP的HASH算法</a>, 基于此, 我们做进一步的延伸.</p>
<p>认识HashTable之前, 首先让我们看看HashTable的结构定义, 我加了注释方便大家理解:</p>
<pre name="code"  class="sh_cpp"  linenum="off"   style="background: #333; color: #d9d9d9; border-left: 15px solid #c9c9c9; padding: 9px; font-size: 1em; overflow-x: auto;font-family:Monacobackground: #333; color: #d9d9d9; border-left: 15px solid #c9c9c9; padding: 9px; font-size: 1em; overflow-x: auto;font-family:MonacoConsolasConsolasCourierCouriermonospace;monospace;">
typedef struct _hashtable {
uint nTableSize;        /* 散列表大小, Hash值的区间 */
uint nTableMask;        /* 等于nTableSize -1, 用于快速定位 */
uint nNumOfElements;    /* HashTable中实际元素的个数 */
ulong nNextFreeElement; /* 下个空闲可用位置的数字索引 */
Bucket *pInternalPointer;   /* 内部位置指针, 会被reset, current这些遍历函数使用 */
Bucket *pListHead;      /* 头元素, 用于线性遍历 */
Bucket *pListTail;      /* 尾元素, 用于线性遍历 */
Bucket **arBuckets;     /* 实际的存储容器 */
dtor_func_t pDestructor;/* 元素的析构函数(指针) */
zend_bool persistent;
unsigned char nApplyCount; /* 循环遍历保护 */
zend_bool bApplyProtection;
#if ZEND_DEBUG
int inconsistent;
#endif
} HashTable;
</pre>
<p>关于nApplyCount的意义, 我们可以通过一个例子来了解:</p>
<pre name="code"  class="sh_php"  linenum="off"   style="background: #333; color: #d9d9d9; border-left: 15px solid #c9c9c9; padding: 9px; font-size: 1em; overflow-x: auto;font-family:Monacobackground: #333; color: #d9d9d9; border-left: 15px solid #c9c9c9; padding: 9px; font-size: 1em; overflow-x: auto;font-family:MonacoConsolasConsolasCourierCouriermonospace;monospace;">
&lt;?php
    $arr = array(1,2,3,4,5,);
    $arr[] = &amp;$arr;

    var_export($arr); //Fatal error: Nesting level too deep - recursive dependency?
</pre>
<p>    这个字段就是为了防治循环引用导致的无限循环而设立的.</p>
<p>    查看上面的结构, 可以看出, 对于HashTable, 关键元素就是arBuckets了, 这个是实际存储的容器, 让我们来看看它的结构定义:</p>
<pre name="code"  class="sh_cpp"  linenum="off"   style="background: #333; color: #d9d9d9; border-left: 15px solid #c9c9c9; padding: 9px; font-size: 1em; overflow-x: auto;font-family:Monacobackground: #333; color: #d9d9d9; border-left: 15px solid #c9c9c9; padding: 9px; font-size: 1em; overflow-x: auto;font-family:MonacoConsolasConsolasCourierCouriermonospace;monospace;">
typedef struct bucket {
ulong h;                        /* 数字索引/hash值 */
uint nKeyLength;                /* 字符索引的长度 */
void *pData;                    /* 数据 */
void *pDataPtr;                 /* 数据指针 */
struct bucket *pListNext;               /* 下一个元素, 用于线性遍历 */
struct bucket *pListLast;       /* 上一个元素, 用于线性遍历 */
struct bucket *pNext;                   /* 处于同一个拉链中的下一个元素 */
struct bucket *pLast;                   /* 处于同一拉链中的上一个元素 */
char arKey[1]; /* 节省内存,方便初始化的技巧 */
} Bucket;
</pre>
<p>我们注意到, 最后一个元素, 这个是flexible array技巧, 可以节省内存,和方便初始化的一种做法, 有兴趣的朋友可以google flexible array.</p>
<p>h是元素的Hash值,对于数字索引的元素,h为直接索引值(通过nKeyLength=0来表示是数字索引).而对于字符串索引来说, 索引值保存在arKey中, 索引的长度保存在nKeyLength中.</p>
<p>在Bucket中，实际的数据是保存在pData指针指向的内存块中，通常这个内存块是系统另外分配的。但有一种情况例外，就是当Bucket保存 的数据是一个指针时，HashTable将不会另外请求系统分配空间来保存这个指针，而是直接将该指针保存到pDataPtr中，然后再将pData指向本结构成员的地址。这样可以提高效率，减少内存碎片。由此我们可以看到PHP HashTable设计的精妙之处。如果Bucket中的数据不是一个指针，pDataPtr为NULL(本段来自Altair<eniac2008@hotmail.com>的&#8221;Zend HashTable详解&#8221;)</p>
<p>结合上面的HashTable结构, 我们来说明下HashTable的总结构图:<br/>
<div id="attachment_1011"  class="wp-caption aligncenter"  style="width: 510px" ><a href="http://laruence-wordpress.stor.sinaapp.com/uploads/e697a0e6a087e9a298.jpg" ><img src="http://laruence-wordpress.stor.sinaapp.com/uploads/e697a0e6a087e9a298.jpg"  alt="HashTable结构示意图"  title="e697a0e6a087e9a298"  width="500"  height="326"  class="size-full wp-image-1011" /></a><p class="wp-caption-text" >HashTable结构示意图</p></div></p>
<p>HashTable的pListhHead指向线性列表形式下的第一个元素, 上图中是元素1, pListTail指向的是最后一个元素0, 而对于每一个元素pListNext就是红色线条画出的线性结构的下一个元素, 而pListLast是上一个元素.</p>
<p>pInternalPointer指向当前的内部指针的位置, 在对数组进行顺序遍历的时候, 这个指针指明了当前的元素.</p>
<p>当在线性(顺序)遍历的时候, 就会从pListHead开始, 顺着Bucket中的pListNext/pListLast, 根据移动pInternalPointer, 来实现对所有元素的线性遍历. </p>
<p>比如, 对于foreach, 如果我们查看它生成的opcode序列, 我们可以发现, 在foreach之前, 会首先有个FE_RESET来重置数组的内部指针, 也就是pInternalPointer(关于foreach可以参看<a href="http://www.laruence.com/2008/11/20/630.html" >深入理解PHP原理之foreach</a>), 然后通过每次FE_FETCH来递增pInternalPointer,从而实现顺序遍历.</p>
<p>类似的, 当我们使用, each/next系列函数来遍历的时候, 也是通过移动数组的内部指针而实现了顺序遍历, 这里有一个问题, 比如:</p>
<pre name="code"  class="sh_php"  linenum="off"   style="background: #333; color: #d9d9d9; border-left: 15px solid #c9c9c9; padding: 9px; font-size: 1em; overflow-x: auto;font-family:Monacobackground: #333; color: #d9d9d9; border-left: 15px solid #c9c9c9; padding: 9px; font-size: 1em; overflow-x: auto;font-family:MonacoConsolasConsolasCourierCouriermonospace;monospace;">
&lt;?php
$arr = array(1,2,3,4,5);
foreach ($arr as $v) {
//可以获取
}

while (list($key, $v) = each($arr)) {
//获取不到
}
?&gt;
</pre>
<p>了解到我刚才介绍的知识, 那么这个问题也就很明朗了, 因为foreach会自动reset, 而while这块不会reset, 所以在foreach结束以后, pInternalPointer指向数组最末端, while语句块当然访问不到了, 解决的办法就是在each之前, 先reset数组的内部指针.</p>
<p>而在随机访问的时候, 就会通过hash值确定在hash数组中的头指针位置, 然后通过pNext/pLast来找到特点元素.</p>
<p>增加元素的时候, 元素会插在相同Hash元素链的头部和线性列表的尾部. 也就是说, 元素在线性遍历的时候是根据插入的先后顺序来遍历的, 这个特殊的设计使得在PHP中,当使用数字索引时, 元素的先后顺序是由添加的顺序决定的,而不是索引顺序.</p>
<p>也就是说, PHP中遍历数组的顺序, 是和元素的添加先后相关的, 那么, 现在我们就很清楚的知道, 文章开头的问题的输出是:</p>
<pre name="code"  class="sh_php"  linenum="off"   style="background: #333; color: #d9d9d9; border-left: 15px solid #c9c9c9; padding: 9px; font-size: 1em; overflow-x: auto;font-family:Monacobackground: #333; color: #d9d9d9; border-left: 15px solid #c9c9c9; padding: 9px; font-size: 1em; overflow-x: auto;font-family:MonacoConsolasConsolasCourierCouriermonospace;monospace;">
huixinchen
2007
2008
</pre>
<p>所以, 如果你想在数字索引的数组中按照索引大小遍历, 那么你就应该使用for, 而不是foreach</p>
<pre name="code"  class="sh_php"  linenum="off"   style="background: #333; color: #d9d9d9; border-left: 15px solid #c9c9c9; padding: 9px; font-size: 1em; overflow-x: auto;font-family:Monacobackground: #333; color: #d9d9d9; border-left: 15px solid #c9c9c9; padding: 9px; font-size: 1em; overflow-x: auto;font-family:MonacoConsolasConsolasCourierCouriermonospace;monospace;">
for($i=0,$l=count($arr); $i&lt;$l; $i++) {
 //这个时候,不能认为是顺序遍历(线性遍历)
}
</pre>
</p>
<p><script type="text/javascript"  src="http://www.laruence.com/wp-content/plugins/shjs-syntax-hiliter/shjs/lang/sh_php.js" ></script><script type="text/javascript"  src="http://www.laruence.com/wp-content/plugins/shjs-syntax-hiliter/shjs/lang/sh_php.js" ></script><script type="text/javascript"  src="http://www.laruence.com/wp-content/plugins/shjs-syntax-hiliter/shjs/lang/sh_cpp.js" ></script><script type="text/javascript"  src="http://www.laruence.com/wp-content/plugins/shjs-syntax-hiliter/shjs/lang/sh_php.js" ></script><script type="text/javascript"  src="http://www.laruence.com/wp-content/plugins/shjs-syntax-hiliter/shjs/lang/sh_cpp.js" ></script><script type="text/javascript"  src="http://www.laruence.com/wp-content/plugins/shjs-syntax-hiliter/shjs/lang/sh_php.js" ></script><script type="text/javascript"  src="http://www.laruence.com/wp-content/plugins/shjs-syntax-hiliter/shjs/lang/sh_php.js" ></script><script type="text/javascript"  src="http://www.laruence.com/wp-content/plugins/shjs-syntax-hiliter/shjs/lang/sh_php.js" ></script></p>
<hr/><h2>Comments</h2><ul  style="padding-left:1em;font-size:85%;padding-left:1em;font-size:85%;"><li><a href="http://www.laruence.com/2009/08/23/1065.html" >2009/08/23</a>, <a href="http://phppan.com"  rel="external nofollow"  class="url" >phppan</a> writes: 学习了！
感谢LZ</li><li><a href="http://www.laruence.com/2009/08/23/1065.html" >2009/08/23</a>, cyj writes: 博主您好，我现在遇到了一个问题。

我定义了一个模块全局变量。
ZEND_BEGIN_MODULE_GLOBALS(sample4)
  HASHTABLE *ht;
ZEND_END_MODULE_GLOBALS(sample4)

在
101 static void php_hello1_init_globals(zend_hello1_globals *hello1_globals TSRMLS_DC)
102 {
103
104     ALLOC_HASHTABLE(HELLO1_G(apps_config));
105     if(zend_hash_init(HELLO1_G(apps_config),
106                       8, NULL, free_app_config, 0) == FAILURE)
107     {
108        FREE_HASHTABLE(HELLO1_G(apps_config));
109     }
110     char string[11] = "chenyujian";
111     zval *app_name ;
112
113     MAKE_STD_ZVAL(app_name);
114     ZVAL_STRING(app_name, "chen", 1);
115
116     if(zend_hash_add(HELLO1_G(apps_config), "bar", sizeof("bar"), &amp;app_name, sizeof(zval*), NULL) == SUCCESS)
117     {
118     }
119     if(zend_hash_add(HELLO1_G(apps_config), string, sizeof(string), &amp;app_name, sizeof(zval*), NULL) == SUCCESS)
120     {
121       php_printf("size of:%s:%d\n",string,sizeof(string));
122     }
123     zval **args;
124     if(zend_hash_find(HELLO1_G(apps_config), string, sizeof(string), (void **) &amp;args) == SUCCESS)
125     {
126
127       char *m = Z_STRVAL_PP(args);
128       php_printf("%s\n",m);
129     }else
130     {
131       php_printf("not found");
132     }
133 }
134 static void php_hello1_globals_dtor(zend_hello1_globals *hello1_globals TSRMLS_DC)
135 {
136     zend_hash_destroy(HELLO1_G(apps_config));
137     /* Free the HashTable itself */
138     FREE_HASHTABLE(HELLO1_G(apps_config));
139     HELLO1_G(apps_config) = NULL;
140 }
PHP_MINIT()里面进行HASH初始化，这时候遇到了几个问题，一，在Module中初始化后，在MSHUTDOWN中进行进行释放（
136     zend_hash_destroy(HELLO1_G(apps_config));
137     /* Free the HashTable itself */
138     FREE_HASHTABLE(HELLO1_G(apps_config));）
出现了segment fault错误。
二：在rini中进行hashtable的hash_add出现了segmentfault错误。

这让我百思不得其解，当然在rini中进行 hash_init 再进行 hash_add是没有问题的。不知道究竟是什么原因。</li><li><a href="http://www.laruence.com/2009/08/23/1065.html" >2009/08/23</a>, <a href="http://neatcn.com"  rel="external nofollow"  class="url" >膘叔</a> writes:  $val) {
//现在结果又是什么?
    echo( $val );
    echo( '' );
} 
while (list($k, $value) = each($arr)) {
    echo "Key: $k; Value: $value\n";
}
很奇怪，while那段是没有输出的。
如果把这两个顺序填倒过来。则有输出
如果在while结束后，输出字符，也是会有字符串输出，证明代码没有出错。
何解？</li><li><a href="http://www.laruence.com/2009/08/23/1065.html" >2009/08/23</a>, <a href="http://www.laruence.com"  rel="external nofollow"  class="url" >雪候鸟</a> writes: @膘叔 你的代码不全, 没看太明白, 但应该是内部指针的问题, 你可以在while之前reset一下, 看看是否正确.</li><li><a href="http://www.laruence.com/2009/08/23/1065.html" >2009/08/23</a>, <a href="http://www.laruence.com"  rel="external nofollow"  class="url" >雪候鸟</a> writes: @cyj 如果可以的话, 请发送你的代码(全部可编译的)到我的邮箱, yahoo.com.cn的, 我帮你看看~</li><li><a href="http://www.laruence.com/2009/08/23/1065.html" >2009/08/24</a>, cyj writes: 已发送，请查收。</li><li><a href="http://www.laruence.com/2009/08/23/1065.html" >2009/08/27</a>, MaJia writes: 楼主,好图啊!</li><li><a href="http://www.laruence.com/2009/08/23/1065.html" >2009/08/28</a>, ning writes: 所以, 如果你想在数字索引的数组中按照索引大小遍历, 那么你就应该使用for, 而不是foreach

ksoft</li><li><a href="http://www.laruence.com/2009/08/23/1065.html" >2009/10/16</a>, <a href="http://www.xidea.org"  rel="external nofollow"  class="url" >jindw</a> writes: 这可是个陷阱，看来火麒麟中间代码翻译那块该修改修改了。

专业，受教。</li><li><a href="http://www.laruence.com/2009/08/23/1065.html" >2009/10/27</a>, noname writes: 博主您好

请问一下，
struct bucket *pNext;                 
struct bucket *pLast;
这两个指针的作用是什么，它们和
struct bucket *pListNext;             
struct bucket *pListLast;
的区别是什么

谢谢</li><li><a href="http://www.laruence.com/2009/08/23/1065.html" >2009/10/27</a>, <a href="http://www.laruence.com"  rel="external nofollow"  class="url" >laruence</a> writes: pNext是同一hash值冲突时候拉链的下一个元素.
pListNext是所有的元素的串联, 文章中有描述, 你可以再自习看看</li><li><a href="http://www.laruence.com/2009/08/23/1065.html" >2009/11/25</a>, laja writes: array的count是直接取 nNumOfElements 吗？

还是内部遍历？</li><li><a href="http://www.laruence.com/2009/08/23/1065.html" >2010/01/17</a>, <a href="http://www.phppan.com/2010/01/php-sound-code-4-count/"  rel="external nofollow"  class="url" >PHP源码阅读笔记四：count函数 | 胖子的空间</a> writes: [...] 如果想直接运行HashTable的一些简单操作，猛击PHP源码中HashTable的简单示例 如果想查看了解数组存储或遍历的方式，猛击鸟哥的深入理解PHP之数组(遍历顺序) [...]</li><li><a href="http://www.laruence.com/2009/08/23/1065.html" >2010/03/01</a>, <a href="http://t.sina.com.cn/liruqi"  rel="external nofollow"  class="url" >liruqi</a> writes: 有个笔误.
"对于数字索引来说, 索引值保存在arKey中, 索引的长度保存在nKeyLength中."
应该是"对于字符串索引"吧!</li><li><a href="http://www.laruence.com/2009/08/23/1065.html" >2010/03/01</a>, <a href="http://www.laruence.com"  rel="external nofollow"  class="url" >雪候鸟</a> writes: @liruqi 呵呵, 还真是,,写错了, 谢谢</li><li><a href="http://www.laruence.com/2009/08/23/1065.html" >2010/07/04</a>, <a href="http://www.zhow.tk/archives/9"  rel="external nofollow"  class="url" >php数组的字符型索引是否应该遵循变量命名规则？ - 完美人生</a> writes: [...] 今天，趁项目暂时不用冒烟赶进度的上来look look，总算是有些弄清楚这个问题了，这里要特别感谢鸟哥的数篇PHP内核级文章，例如：《PHP中的Hash算法》、《深入理解PHP之数组(遍历顺序)》等等。先来段测试代码： [...]</li><li><a href="http://www.laruence.com/2009/08/23/1065.html" >2010/10/07</a>, <a href="http://imdonkey.com/blog/archives/595"  rel="external nofollow"  class="url" >SPL学习笔记</a> writes: [...] php程序员使用最多的数据结构应该就是数组(array)了吧，不管是实现个列表、队列、哈希还是别的什么数据集，都会先想到用array模拟，因为它既方便使用又功能强大(很多函数支持)。你甚至会不由得感叹，php的array真是万能啊！(php中array的底层实现方式可以参考深入理解PHP之数组) [...]</li><li><a href="http://www.laruence.com/2009/08/23/1065.html" >2011/03/04</a>, <a href="http://www.laruence.com/2011/03/04/1894.html"  rel="external nofollow"  class="url" >谁动了我的内存(PHP内存管理) | 风雪之隅</a> writes: [...] 可以参看我之前的文章深入理解PHP之数组(遍历顺序)), 数组也是用她来表示的, 而符号表也是一种关联数组, 对于如下代码: [...]</li><li><a href="http://www.laruence.com/2009/08/23/1065.html" >2011/03/20</a>, <a href="http://www.w3hacker.com/?p=293"  rel="external nofollow"  class="url" >深入理解PHP之数组(遍历顺序) | 万维网黑客联盟</a> writes: [...] 本文地址: http://www.laruence.com/2009/08/23/1065.html [...]</li><li><a href="http://www.laruence.com/2009/08/23/1065.html" >2011/06/23</a>, <a href="http://www.daoci.net/php/yiyou_190"  rel="external nofollow"  class="url" >php 内存管理 | 到此一游</a> writes: [...] 可以参看我之前的文章深入理解PHP之数组(遍历顺序)), 数组也是用她来表示的, 而符号表也是一种关联数组, [...]</li><li><a href="http://www.laruence.com/2009/08/23/1065.html" >2011/08/01</a>, <a href="http://www.youxiname.net/"  rel="external nofollow"  class="url" >网络游戏名字大全</a> writes: 写的不错 在学习 php</li><li><a href="http://www.laruence.com/2009/08/23/1065.html" >2011/08/09</a>, <a href="http://www.alexthink.com"  rel="external nofollow"  class="url" >alex</a> writes: 喜欢这种底层分析的文章，期待更多分享啊。</li><li><a href="http://www.laruence.com/2009/08/23/1065.html" >2011/11/24</a>, <a href="http://blog.chedushi.com/archives/1967"  rel="external nofollow"  class="url" >深入理解PHP之数组遍历 | 岭南六少 - 一朵在LAMP架构下挣扎的云</a> writes: [...] 本文地址: http://www.laruence.com/2009/08/23/1065.html 经常会有人问我, PHP的数组, 如果用foreach来访问, 遍历的顺序是固定的么? 以什么顺序遍历呢? 比如: [...]</li></ul><hr/><h2>Related posts:</h2><ul  style="padding-left:1em;font-size:85%;padding-left:1em;font-size:85%;"><li><a href="http://www.laruence.com/2009/07/27/1020.html"  rel="bookmark"  title="Permanent Link: 深入理解PHP原理之错误抑制与内嵌HTML" >深入理解PHP原理之错误抑制与内嵌HTML</a></li><li><a href="http://www.laruence.com/2008/08/26/463.html"  rel="bookmark"  title="Permanent Link: 深入理解PHP原理之变量作用域(Scope in PHP)" >深入理解PHP原理之变量作用域(Scope in PHP)</a></li><li><a href="http://www.laruence.com/2011/03/29/1949.html"  rel="bookmark"  title="Permanent Link: 深入理解PHP原理之Session Gc的一个小概率Notice" >深入理解PHP原理之Session Gc的一个小概率Notice</a></li><li><a href="http://www.laruence.com/2010/06/20/1602.html"  rel="bookmark"  title="Permanent Link: 深入理解PHP之匿名函数" >深入理解PHP之匿名函数</a></li><li><a href="http://www.laruence.com/2010/05/04/1450.html"  rel="bookmark"  title="Permanent Link: 深入理解PHP之require/include顺序" >深入理解PHP之require/include顺序</a></li></ul><hr/><small  style="font-size:85%;font-size:85%;">Copyright &copy; 2010 <a href="http://www.laruence.com"  target="_blank" >风雪之隅</a> 版权所有, 转载务必注明. 该Feed只供个人使用, 禁止未注明的转载或商业应用. 非法应用的, 一切法律后果自负. 如有问题, 可发E-mail至my at laruence.com.(Digital Fingerprint: 73540ba0a1738d7d07d4b6038d5615e2)</small><h2 class="related_post_title" >Related Posts:</h2><ul class="related_post"   style="padding-left:1em;font-size:85%;padding-left:1em;font-size:85%;"><li><a href="http://www.laruence.com/2012/02/08/2528.html"  title="PHP-5.3.9远程执行任意代码漏洞(CVE-2012-0830)" >PHP-5.3.9远程执行任意代码漏洞(CVE-2012-0830)</a></li><li><a href="http://www.laruence.com/2012/02/02/2515.html"  title="我们什么时候应该使用异常?" >我们什么时候应该使用异常?</a></li><li><a href="http://www.laruence.com/2012/02/01/2503.html"  title="使用exit(-1)为什么得到255退出码?" >使用exit(-1)为什么得到255退出码?</a></li><li><a href="http://www.laruence.com/2012/01/11/2482.html"  title="PHP的历史" >PHP的历史</a></li><li><a href="http://www.laruence.com/2012/01/10/2469.html"  title="如何设置一个严格30分钟过期的Session" >如何设置一个严格30分钟过期的Session</a></li><li><a href="http://www.laruence.com/2012/01/07/2453.html"  title="2012年1月全球www网站技术报告" >2012年1月全球www网站技术报告</a></li><li><a href="http://www.laruence.com/2011/12/30/2440.html"  title="PHP5.2.*防止Hash冲突拒绝服务攻击的Patch" >PHP5.2.*防止Hash冲突拒绝服务攻击的Patch</a></li><li><a href="http://www.laruence.com/2011/12/30/2435.html"  title="PHP数组的Hash冲突实例" >PHP数组的Hash冲突实例</a></li><li><a href="http://www.laruence.com/2011/12/29/2412.html"  title="通过构造Hash冲突实现各种语言的拒绝服务攻击" >通过构造Hash冲突实现各种语言的拒绝服务攻击</a></li><li><a href="http://www.laruence.com/2011/12/06/2381.html"  title="更简单的重现PHP Core的调用栈" >更简单的重现PHP Core的调用栈</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.laruence.com/2009/08/23/1065.html/feed</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
	</channel>
</rss>

