<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></title> 
<link>http://www.jackxiang.com/index.php</link> 
<description><![CDATA[赢在IT，Playin' with IT,Focus on Killer Application,Marketing Meets Technology.]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></copyright>
<item>
<link>http://www.jackxiang.com/post//</link>
<title><![CDATA[PHP array_keys() 函数和PHP shuffle() 函数。]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[Php/Js/Shell/Go]]></category>
<pubDate>Fri, 12 Jul 2013 09:11:15 +0000</pubDate> 
<guid>http://www.jackxiang.com/post//</guid> 
<description>
<![CDATA[ 
	背景：近来看有兄弟用PHP shuffle() 函数，PHP array_keys() 函数做随机，<br/>好像是混合用的，就查下手册了解下PHP array_keys() 函数和PHP shuffle() 函数。<br/>-----------------------------------------------------------------------------------------------------------------------<br/>一）array_keys定义和用法<br/>array_keys() 函数返回包含数组中所有键名的一个新数组。<br/>如果提供了第二个参数，则只返回键值为该值的键名。<br/>如果 strict 参数指定为 true，则 PHP 会使用全等比较 (===) 来严格检查键值的数据类型。<br/><textarea name="code" class="php" rows="15" cols="100">
&lt;?php
$a=array(&quot;a&quot;=&gt;&quot;Horse&quot;,&quot;b&quot;=&gt;&quot;Cat&quot;,&quot;c&quot;=&gt;&quot;Dog&quot;);
print_r(array_keys($a));
?&gt;
</textarea><br/>输出：<br/>---------- 调试PHP ----------<br/>Array<br/>(<br/>&nbsp;&nbsp;&nbsp;&nbsp;[0] =&gt; a<br/>&nbsp;&nbsp;&nbsp;&nbsp;[1] =&gt; b<br/>&nbsp;&nbsp;&nbsp;&nbsp;[2] =&gt; c<br/>)<br/>输出完成 (耗时 0 秒) - 正常终止。<br/><br/>二）shuffle定义和用法<br/>shuffle() 函数把数组中的元素按随机顺序重新排列。<br/>若成功，则返回 TRUE，否则返回 FALSE。<br/>注释：本函数为数组中的单元赋予新的键名。这将删除原有的键名而不仅是重新排序。<br/>注释：自 PHP 4.2.0 起，不再需要用 srand() 或 mt_srand() 函数给随机数发生器播种，现已被自动完成。<br/>语法<br/>shuffle(array)<br/>参数 &nbsp;&nbsp;描述<br/>array &nbsp;&nbsp;必需。规定要使用的数组。<br/><textarea name="code" class="php" rows="15" cols="100">
&lt;?php
$my_array = array(&quot;a&quot; =&gt; &quot;Dog&quot;, &quot;b&quot; =&gt; &quot;Cat&quot;, &quot;c&quot; =&gt; &quot;Horse&quot;);
shuffle($my_array);
print_r($my_array);
?&gt;
</textarea><br/>输出：<br/>---------- 调试PHP ----------<br/>Array<br/>(<br/>&nbsp;&nbsp;&nbsp;&nbsp;[0] =&gt; Dog<br/>&nbsp;&nbsp;&nbsp;&nbsp;[1] =&gt; Horse<br/>&nbsp;&nbsp;&nbsp;&nbsp;[2] =&gt; Cat<br/>)<br/><br/>输出完成 (耗时 0 秒) - 正常终止。<br/>
]]>
</description>
</item><item>
<link>http://www.jackxiang.com/post//#blogcomment</link>
<title><![CDATA[[评论] PHP array_keys() 函数和PHP shuffle() 函数。]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://www.jackxiang.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>