Challenge: Formatter and Hash Generators with Updated Functions
A hands-on exercise to test your understanding of PHP 8’s deprecated or removed functionalities.
This challenge will extensively test your understanding of PHP 8’s deprecated or removed functionalities.
Task 1
Create a PHP script that formats a monetary amount in different locales.
Set the monetary locale to Japan, Germany, France, and the United Kingdom and format a given amount accordingly.
Instructions
Modify the existing code to include two additional locales: France and the United Kingdom.
For each of the four locales (Japan, Germany, France, and the United Kingdom), format the monetary amount of 4,395,794.89 using the appropriate currency symbol and formatting rules. You can use the provided code as a reference for formatting.
Display the formatted monetary amount for each locale and indicate whether it’s for national or international use. For example:
National (Japan): ¥4,395,794.89
International (Japan): JPY 4,395,794.89
Ensure the outputs have the correct currency symbols and formatting for each locale.
Write comments in the code to explain the purpose and functionality of each part.
Constraints
Include four locales: Japan (
ja_JP
and JPY), Germany (de_DE
and EUR), France (fr_FR
and EUR), and the United Kingdom (en_GB
and GBP).Ensure that the code outputs the formatted monetary amounts for each locale and indicates whether it’s for national or international use.
Coding playground
Get hands-on with 1200+ tech skills courses.