how to limit float to 2 decimal places in php code example Example: limit two decimal php return number_format((float)$number, 2, '.', '');