Search
 
SCRIPT & CODE EXAMPLE
 

PHP

two digits after decimal point in php

echo round(520.34345, 2);   // 520.34
echo round(520.3, 2);       // 520.3
echo round(520, 2);         // 520
Comment

number format in php with decimal values

<?php
$number1 = 5;
$number2 = 34.600;
$number3 = 15439.093;
$format_number1 = number_format($number1, 2);
$format_number2 = number_format($number2, 2);
$format_number3 = number_format($number3, 2, "d", "@");
echo "The number $number1 after formating is: $format_number1 
";
echo "The number $number2 after formating is: $format_number2 
";
echo "The number $number3 after formating is: $format_number3 
";

//Output

The number 5 after formating is: 5.00 
The number 34.6 after formating is: 34.60 
The number 15439.093 after formating is: 15@439d09


?>
Comment

convert number to 2 decimal places in php

echo round(5366.8122270742, 2); //5366.81
Comment

PREVIOUS NEXT
Code Example
Php :: php check if url exists 
Php :: php string cut first x characters 
Php :: row count in codeigniter 
Php :: get first key of array php 
Php :: url encode php 
Php :: php get subdomain 
Php :: get user ip in php 
Php :: check if a string contains a substring php 
Php :: get_user_meta 
Php :: laravel make trait command 
Php :: array_unique 
Php :: laravel migration price 
Php :: Unresolvable dependency resolving [Parameter #0 
Php :: In Connection.php line 664:SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from information_schema.tables where table_schema 
Php :: laravel test assert redirecto to 
Php :: install php7.4 in linux server 
Php :: install phpmyadmin ubuntu 
Php :: php get current year 
Php :: laravel validate number to be at least 3 digits 
Php :: for loop php 
Php :: php find differences between two arrays 
Php :: check table exists in db laravel 
Php :: first day of month php 
Php :: strtolower php 
Php :: change background color php 
Php :: htaccess replace url parameter with slash prameter 
Php :: echo query in laravel 
Php :: laravel check if get is empty 
Php :: laravel database connection check 
Php :: collection laravel filter 
ADD CONTENT
Topic
Content
Source link
Name
8+7 =