Home Tutorial Php Phpbasics Tutorial PHP Float Number Format

 
 

PHP Float Number Format
Posted on: March 15, 2010 at 12:00 AM
Advertisement
In this tutorial you will study about float number in PHP, different examples will illustrate the concept

PHP Float Number:

In our daily life we use different kind of number systems. Integer and Float numbers are most common in use. In the current tutorial we will study about Float number system.

Float number system or floating point numbers also known as "floats", "doubles", or "real numbers".

Following examples will help you to learn floating point number precisely.

Example:

<?php

$a=34.0000;

echo "Value of a is:".$a;

echo '<br/>Value of a is :'.((float)($a));

echo "<br/>Data type of a is; ". (gettype($a));

?>

Output:

Value of a is:34
Value of a is :34
Data type of a is; double

Example:

<?php

$a = 1.234;

$b = 1.2e3;

$c = 7E-10;

var_dump($a);

var_dump($b);

var_dump($c);

?>

Output:

float(1.234) float(1200) float(7.0E-10)

Advertisement

Related Tags for PHP Float Number Format:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: March 15, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com