Floats in PHP: Handling Decimal Numbers

Rumman Ansari   Software Engineer   2024-07-09 10:05:06   5506  Share
Subject Syllabus DetailsSubject Details
☰ TContent
☰Fullscreen

Table of Content:

A float (a floating-point number) is a number with a decimal point or a number in exponential form.

In the following example, $x is a float. The PHP var_dump() function returns the data type and value:

Example Code:


<?php

$x = 10.365;
var_dump($x);

?>


Output:

The above code will produce the following result-


float(10.365)