Php provides different numeric variable types. In this tutorial we will look them in detail. The numeric types available in Php are listed below.
Numeric values are used mainly used for mathematical calculations. If we will use numbers just like id or school number better way is using string but if we will made calculations, dividing etc. we need numeric variable types.
Integer type variables holds non floating numeric and calculable values. We can use integer variables to hold count, round type situations. Here we will make an example about integer. We will use
$count integer variable to hold count of students.
$count = 23;
Each integer variable holds 4 byte in the memory. The maximum and minimum values changed according to system architecture like 32 or 64 bit.
Integers have vast use cases but it is not enough to express all numeric cases. Float type of variables are used to store floating point numbers. In this example we will store price of a laptop with a floating point number. We will use point
. to specify decimal and floating point part like below.
Another floating point definition syntax is using
e for 64 bit IEEE format like below.