0

I have a float that outputs as

float 1.5

I need to output as

float 1.50 or as a decimal, this give me a string.

 $delivery_cost = number_format((float)$deliveryCharge, 2);
LeBlaireau
  • 17,133
  • 33
  • 112
  • 192
  • what's the problem? you're doing output, which means you're displaying strings. you should keep data in their native format until it comes time to display them, and then create a formatted COPY for output. – Marc B Jun 03 '15 at 21:22
  • I need to send it as a decimal not as a string and with the 2 decimal placed to an api. – LeBlaireau Jun 03 '15 at 21:25
  • 1
    unless that api's taking in a binary format, you're probably building xlm or json or whatever, which are all TEXT. – Marc B Jun 03 '15 at 21:26

0 Answers0