For more information, see [php]. if five rows of data at the end of the returned text are 1305140646, 22013, 82013-5-14 & nbsp; 16: 40: 001305140652,0,-5-14 & nbsp; 16: 50: 001305140664,3, 22013,-5-14 & nbsp;: 001305140 ask, if php returns 5 rows of data at the end of the text
1305140646,9,1,4,22013-5-14 16:40:00
1305140652,0,1,4,82013-5-14 16:50:00
1305140664,3,4,6,22013-5-14 17:00:00
1305140676,9,4,1,22013-5-14 17:10:00
1305140683,9,1,5,02013-5-14 17:20:00
1305140697,0,4,7,82013-5-14 17:30:00
1305140703,0,3,0,02013-5-14 17:40:00
1305140711,5,3,8,92013-5-14 17:50:00
1305140723,4,4,6,82013-5-14 18:00:00
1305140737,8,8,5,32013-5-14 18:10:00
In php, how can I return the last five rows of data in a text (the row height is dynamic.
The expected result is as follows:
1305140697,0,4,7,82013-5-14 17:30:00
1305140703,0,3,0,02013-5-14 17:40:00
1305140711,5,3,8,92013-5-14 17:50:00
1305140723,4,4,6,82013-5-14 18:00:00
1305140737,8,8,5,32013-5-14 18:10:00
Share:
------ Solution --------------------
Isn't it the same?
$a = file('http://web45800.w221.vhost058.cn/test.php');
print_r(array_slice($a, -5));Array
(
[0] => 1305140133, 3, 42013,-5-14 19:40:00
[1] => 1305140833,2, 7,4, 02013-5-14 19:50:00
[2] => 1305140842,5, 9, 42013-5-14 20:00:00
[3] => 1305140855,8, 72013,-5-14 20:10:00
[4] => 13051408672013,-5-14 20:20:00
)