In what scenarios would it be more efficient to handle number formatting in PHP rather than JavaScript for a web application?

When dealing with server-side data manipulation or when the formatting needs to be consistent across multiple client-side components, it may be more efficient to handle number formatting in PHP rather than JavaScript for a web application. This can help streamline the codebase and reduce the amount of client-side processing required.

<?php
// Format a number in PHP
$number = 1234.56;
$formatted_number = number_format($number, 2, '.', ',');
echo $formatted_number; // Output: 1,234.56
?>