开发者

php read from file float

Hello I have a text file with three 开发者_运维百科lines. every line has a float number. How can I take each value and put in a float variable even if array?

For example text file is like the following

+3.01\n
-0.0012\n
-0.1\n

I want an array [if it possible] which save the values as float not as string.

Thanks


$fileArr = file($fileName);
$fileArr = array_map('floatval', $fileArr);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜