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