What PHP function can be used to format numbers with thousands separators?

When working with numbers in PHP, you may need to format them with thousands separators for better readability. The `number_format()` function in PHP can be used to achieve this. This function takes a number as input and returns a formatted string with thousands separators.

$number = 10000;
$formatted_number = number_format($number);
echo $formatted_number; // Output: 10,000