A number is a mathematical object and one of the datatypes which is used to count, measure and calculation. In computer programming, a number is very important datatype. PHP has two types of numbers, Integers & Floating point numbers. PHP allows us to perform different PHP Number Manipulation operations on numbers for example comparing numbers, operation on series etc.
Using PHP's built in function is_int() and is_double(), it is possible to check whether variable is a number.
This will produce following result
Using PHP's built in function gettype(), it is possible to check whether variable is a number by getting its type.
This will produce following result
Using PHP's built in function round(), it is possible to round off floating point number through round() function.
This will produce following result
Using PHP's built in function abs(), it is possible to compare two approximately equal floating point numbers through abs() function.
This will produce following result
Using PHP's built in function abs(), it is possible to apply a single code to a range of integers using loops.
This will produce following result
Using PHP's built in function sort(), it is possible to search for the number having minimum value in an array of unordered numbers.
This will produce following result
Using PHP's built in function sort(), it is possible to search for the number having maximum value in an array of unordered numbers.
This will produce following result
Using PHP's built in function decbin() and bindec(), it is possible to convert a number into binary and decimal.
Using PHP's built in function octdec() and hexdec(), it is possible to convert a number into octal and hexadecimal.
Using PHP's built in function number_format(), it is possible to output a number with commas in the correct places.