标签:count 技术分享 alt span 分享 img png blog bsp
1.函数的作用:移除数组中重复的值
2.函数的参数:
@params array $array
3.例子:
1 <?php 2 $array1 = range(1,500000,3); 3 $array2 = range(1,500000,4); 4 $arr = array_merge($array1,$array2); 5 echo ‘count :‘ .count($arr) . "\n"; 6 7 $begin_time = microtime(true); 8 array_keys(array_flip($arr)); 9 $end_time = microtime(true); 10 print_r($end_time - $begin_time); 11 12 echo "\n"; 13 $begin_time = microtime(true); 14 array_flip(array_flip($arr)); 15 $end_time = microtime(true); 16 print_r($end_time - $begin_time); 17 18 echo "\n"; 19 $begin_time = microtime(true); 20 array_unique($arr); 21 $end_time = microtime(true); 22 print_r($end_time - $begin_time);
标签:count 技术分享 alt span 分享 img png blog bsp
原文地址:http://www.cnblogs.com/jingjingdidunhe/p/6918168.html