[PHP] Format a number with thousands separators

Created on November 30, 2026

Use number_format to format a number with a comma between each group of three digits by default.

<?php

echo number_format(1000000);

Output

1,000,000
PHP