php convert string to decimal 2 places code example
Example 1: fix to 2 decimal places php
return number_format((float)$number, 2, '.', '');
Example 2: string to decimal php
$num = (double) "10.12";
return number_format((float)$number, 2, '.', '');
$num = (double) "10.12";