Home / PHP Tips Generated By ChatGPT / Limiting Decimal Places in Floating Point Numbers in PHP Limit the number of decimal places in a float using number_format(). Source Code $float = 3.14159; echo number_format($float, 2); // Outputs: 3.14