How can the issue of losing decimal places be resolved when adding GPS coordinates in PHP?

When adding GPS coordinates in PHP, the issue of losing decimal places can be resolved by using the `number_format` function to ensure that the coordinates are formatted with the desired precision. By specifying the number of decimal places in the function, you can control how many decimal places are displayed in the output.

$latitude = 37.7749;
$longitude = -122.4194;

$formatted_latitude = number_format($latitude, 6);
$formatted_longitude = number_format($longitude, 6);

echo "Latitude: $formatted_latitude, Longitude: $formatted_longitude";