Convert a string to a double - is this possible?

前端 未结 4 1616
既然无缘
既然无缘 2020-12-03 04:29

Just wondering in php, if it was possible to convert a string to a double. I am using a financial web service which provides a price as a string. I really need to process th

4条回答
  •  长情又很酷
    2020-12-03 04:52

    For arbitrary precision mathematics PHP offers the Binary Calculator which supports numbers of any size and precision, represented as strings.

    $s = '1234.13';
    $double = bcadd($s,'0',2);
    

    PHP: bcadd

提交回复
热议问题