What's the correct way to round a PHP string to two decimal places?
$number = "520"; // It's a string from a database
$formatted_number = round_to_2dp($number);
echo $formatted_number;
The output should be 520.00
;
How should the round_to_2dp()
function definition be?
![How Do I Round Decimals In PHP? [duplicate]](https://file.115kc.com/storage/eg/image503.jpg)