Formatting a Number in PHP
number_formatЗадание 1
Given a string:
php<?php
$str = '12345678';
?>
Make it into a string:
php'12 345 678'
Задание 2
Given a number:
php<?php
$number = 9876543.21;
?>
Format the number so that it has thousands separators (space) and two digits in the fractional part:
php'9 876 543.21'
Задание 3
Given a number:
php<?php
$price = 1234.5678;
?>
Format the number with thousands separators (dot), two digits in the fractional part, and a currency symbol:
php'€1.234,57'