91-9990449935 0120-4256464 |
PHP MathPHP provides many predefined math constants and functions that can be used to perform mathematical operations. PHP Math: abs() functionThe 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 ExampleOutput: 7 7 7.2 PHP Math: ceil() functionThe ceil() function rounds fractions up. Syntax ExampleOutput: 4 8 -4 PHP Math: floor() functionThe floor() function rounds fractions down. Syntax ExampleOutput: 3 7 -5 PHP Math: sqrt() functionThe sqrt() function returns square root of given argument. Syntax ExampleOutput: 4 5 2.6457513110646 PHP Math: decbin() functionThe decbin() function converts decimal number into binary. It returns binary number as a string. Syntax ExampleOutput: 10 1010 10110 PHP Math: dechex() functionThe dechex() function converts decimal number into hexadecimal. It returns hexadecimal representation of given number as a string. Syntax ExampleOutput: 2 a 16 PHP Math: decoct() functionThe decoct() function converts decimal number into octal. It returns octal representation of given number as a string. Syntax ExampleOutput: 2 12 26 PHP Math: base_convert() functionThe 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 ExampleOutput: 1010 PHP Math: bindec() functionThe bindec() function converts binary number into decimal. Syntax ExampleOutput: 2 10 11 PHP Math FunctionsLet's see the list of important PHP math functions.
Next TopicPHP Array
|