且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

PHP - 从文本文件的末尾阅读

更新时间:2023-01-23 14:03:26

对不起,我不知道我知道了......你想从除了第一个第一个数字130多家大让所有的数字?男人,这是复杂的:D

Sorry, I'm not sure I get it... You want to get all numbers from the first number bigger than 130 except the first one? Man, that's complicated :D

这个怎么样?

$str = "1299491735618,10,84,10,121.6,10,120.0,12994917389996,12,13,14,15,16,17";

$arr = explode(',', $str);

$i = 1;
while ($i < count($arr) && floatval($arr[$i]) < 130)
  $i++;

print_r(array_slice($arr, $i));

输出:

Array
(
    [0] => 12994917389996
    [1] => 12
    [2] => 13
    [3] => 14
    [4] => 15
    [5] => 16
    [6] => 17
)