2[hello] => 2[world] => 1 ) $(function () {$('pre.pret"/> 2[hello] => 2[world] => 1 ) $(function () {$('pre.pret">
array_count_values
计算一维数组中所有值出现的个数
<code><span>$array</span> = <span>array</span>(<span>1</span>, <span>"hello"</span>, <span>1</span>, <span>"world"</span>, <span>"hello"</span>); print_r(array_count_values(<span>$array</span>));</code>
输出:
<code><span>Array</span> ( [<span>1</span>] => <span>2</span> [hello] => <span>2</span> [world] => <span>1</span> )</code>
以上就介绍了PHP里还有这些好用的技巧,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。