format number

Solutions on MaxInterview for format number by the best coders in the world

showing results for - "format number"
Wael
15 May 2020
1$num = 12345.6789;
2echo number_format($num, 2, '.', '') //12345.67
3echo number_format($num, 3, ',', '.') //12.345,678
Vanessa
11 May 2020
1
2$number = 1234.56;
3// Notation anglaise (par défaut)  ENGLISH
4$english_format_number = number_format($number);
5// 1,235
6
7// Notation française   FRENCH
8$nombre_format_francais = number_format($number, 2, ',', ' ');
9// 1 234,56
10
11$number = 1234.5678;
12// Notation anglaise sans séparateur de milliers
13$english_format_number = number_format($number, 2, '.', '');
14// 1234.57
15
16number_format( float $num, int $decimals = 0,
17    	?string $decimal_separator = ".",
18    	?string $thousands_separator = ","
19): string
20
21  
22
23
Valentina
26 Apr 2016
1<?php
2echo number_format("1000000")."<br>";
3echo number_format("1000000",2)."<br>";
4echo number_format("1000000",2,",",".");
5?>
Abigail
22 Nov 2019
1var value = (100000).toLocaleString(
2  undefined, // leave undefined to use the visitor's browser 
3             // locale or a string like 'en-US' to override it.
4  { minimumFractionDigits: 2 }
5);
6console.log(value);
similar questions
queries leading to this page
format number