PHP Convert String into Float/Double

前端 未结 4 1659
灰色年华
灰色年华 2020-12-30 01:00

I have list of string (size in bytes), I read those from file. Let say one of the string is 2968789218, but when I convert it to float it become 2.00.

This is my cod

4条回答
  •  春和景丽
    2020-12-30 01:55

    If the function floatval does not work you can try to make this :

        $string = "2968789218";
        $float = $string * 1.0;
        echo $float;
    

    But for me all the previous answer worked ( try it in http://writecodeonline.com/php/ ) Maybe the problem is on your server ?

提交回复
热议问题