In PHP, try number_format
:
$n = 1234.5678;
// Two decimal places, using '.' for the decimal separator
// and ',' for the thousands separator.
$formatted = number_format($n, 2, '.', ',');
// 1,234.57
More Related Contents:
- How to update multiple MySQL table entries with different id?
- How to run deprecated php codes on the latest XAMPP [duplicate]
- Warning: mysql_connect(): [2002] No such file or directory (trying to connect via unix:///tmp/mysql.sock) in
- How can I use PDO to fetch a results array in PHP?
- Is closing the mysql connection important?
- MySQL check if a table exists without throwing an exception
- Shortcomings of mysql_real_escape_string?
- Alternative to mysql_real_escape_string without connecting to DB
- HTML – Change\Update page contents without refreshing\reloading the page
- Calculate age based on date of birth
- How to write a stored procedure using phpmyadmin and how to use it through php?
- Doing calculations in MySQL vs PHP
- Geo-Search (Distance) in PHP/MySQL (Performance)
- PHP mysql search multiple tables using a keyword
- How do I count unique visitors to my site?
- php code to test pdo is available?
- PHP / MySQL build tree menu
- Long integer is transformed when inserted in shorter column, not truncated. Why? What is the formula?
- How to create Codeigniter language files from database?
- Laravel $q->where() between dates
- WordPress prepared statement with IN() condition
- PHP: Inserting Values from the Form into MySQL
- Using PHP to execute multiple MYSQL Queries
- Select MYSQL rows but rows into columns and column into rows
- How to run multiple insert query in SQL using PHP in one go?
- Create a Insert… Select statement in Laravel
- php/mysql zip code proximity search
- When should I close a database connection in PHP?
- php connection pooling mysql [duplicate]
- Limit pagination page number