PHP MATH FUNCTIONS
PHP Math: Abs() Function
The abs() function returns absolute value of given number. It returns an integer value but if you pass floating point value, it returns a float value.
Syntax
Output:
7 7 7.2
PHP Math: Ceil() Function
The ceil() function rounds fractions up.
Syntax
Output:
4 8 -4
PHP Math: Floor() Function
The floor() function rounds fractions down.
Syntax
Output:
3 7 -5
PHP Math: Sqrt() Function
The sqrt() function returns square root of given argument.
Syntax
Output:
4 5 2.6457513110646
PHP Math: Decbin() Function
The decbin() function converts decimal number into binary. It returns binary number as a string.
Syntax
Output:
10 1010 10110
PHP Math: Dechex() Function
The dechex() function converts decimal number into hexadecimal. It returns hexadecimal representation of given number as a string.
Syntax
Output:
2 a 16
PHP Math: Decoct() Function
The decoct() function converts decimal number into octal. It returns octal representation of given number as a string.
Syntax
Output:
2 12 26
PHP Math: Base_convert() Function
The base_convert() function allows you to convert any base number to any base number. For example, you can convert hexadecimal number to binary, hexadecimal to octal, binary to octal, octal to hexadecimal, binary to decimal etc.
Syntax
Output:
1010
PHP Math: Bindec() Function
The bindec() function converts binary number into decimal.
Syntax
Output:
2 10 11
Comments
Post a Comment