![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
number_format() function in PHP
The number_format() function is used to format a number with grouped thousands.
Syntax
number_format(num,decimals,decimal_pt,separator)
Parameters
num − The number to be formatted.
decimals − Specifies how many decimals.
decimal_pt − The string to be used for decimal point.
separator − Specifies the string to be used for thousands separator.
Return
The number_format() function returns the formatted number.
Example
The following is an example −
<?php echo number_format("10000000"); ?>
Output
The following is the output −
10,000,000
Example
Let us see another example −
<?php echo number_format("3999.9, 2"); ?>
Output
The following is the output −
4,000
Advertisements