最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
php fopen从100万条记录的文本文件取出重复数最多的前10条
时间:2022-06-24 22:50:26 编辑:袖梨 来源:一聚教程网
100万条记录的文本文件,取出重复数最多的前10条。
示例文本:
098
123
234
789
……
234
678
654
123
$fp = fopen('文件', 'r'); while($buf = fgets($fp)) { $res[$buf]++; } fclose($fp); arsort($res); $res = array_keys(array_slice($res, 0, 10)); print_r($res);
$a = file('文件'); $res = array_count_values($a); arsort($res); $res = array_keys(array_slice($res, 0, 10)); print_r($res);
相关文章
- 塞尔达传说王国之泪提马瓦卡神庙怎么过 05-07
- 奇迹暖暖沐光恩典怎么样 05-07
- 奇迹暖暖旧宴恩典怎么玩 05-07
- 以闪亮之名迟夜巡演怎么样 05-07
- Swrv币虚拟货币 05-07
- bzone交易平台 05-07