Home >Backend Development >PHP Tutorial >请教,php中如何按换行符倒序排列
请教,我现有这么一串数据
前5行数据为:
130424007 76346 2013-04-24 00:35:00130424006 56677 2013-04-24 00:30:00130424005 11174 2013-04-24 00:25:00130424004 69889 2013-04-24 00:20:00130424003 15983 2013-04-24 00:15:00
130424003 15983 2013-04-24 00:15:00130424004 69889 2013-04-24 00:20:00130424005 11174 2013-04-24 00:25:00130424006 56677 2013-04-24 00:30:00130424007 76346 2013-04-24 00:35:00
$str = 130424007 76346 2013-04-24 00:35:00
130424006 56677 2013-04-24 00:30:00
130424005 11174 2013-04-24 00:25:00
130424004 69889 2013-04-24 00:20:00
130424003 15983 2013-04-24 00:15:00
txt;
$arr = explode("\n", $str); // 拆分
$arr = array_reverse($arr); // 反转
$str = implode("\n", $arr); // 组合