View percentage in PHP

Asked

Viewed 368 times

0

I need to show a percentage like this 0,75 but it’s showing off like this: 0,00

follows my code:

<?php 
echo number_format((float)$array['JUROS'], 2, ',', '.'); 
?>

The value that comes from the bank is 0,75

Thank you.

  • 1

    The decimal separator in PHP is the point, so it will only understand if it is 0.75, i.e., you will first need to replace the comma by dot before formatting.

  • Okay, it worked. Thank you!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.