Number_format() function in php – onlinecode
In this post we will give you information about Number_format() function in php – onlinecode. Hear we will give you detail about Number_format() function in php – onlinecodeAnd how to use it also give you demo for it if it is necessary.
The number_format() function return the readable number. it takes one, two or four parameters and doesn’t take three parameters. This function gives you an easy way to format numbers for displaying to the user.
The number parameter is an only allow numeric value and it will be formatted without a decimal point and with comma (,) as the thousands separator.
The decimals parameter is an optional value. how many numbers after show decimal point.
The decimal point parameter is an optional value. it is specified which symbols use.
The separator parameter is an optional value. it is specified the thousands separator.
Syntax
number_format(number,decimals,decimalpoint,separator)
See below Example
<?php $number=100000; echo number_format($number).'<br>'; echo number_format($number, 2).'<br>'; echo number_format($number, 3).'<br>'; echo number_format($number, 2, ',', '.'); //output //100,000 //100,000.00 //100,000.000 //100.000,00 ?>
Hope this code and post will helped you for implement Number_format() function in php – onlinecode. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs