PHP is a “**Server Side Language**” this back-end language is used for creating “Dynamic web pages”. As you know, PHP provides us a lot of different features in Web development. And, in this long list of features, Math Function is one of the most useful.

And Today, we will discuss – **“What are PHP MATH Functions?”**

If we need to process mathematical problems. Then For solving these problems In PHP there are various mathematical functions available. There are many predefined PHP math constants and functions that take care of addition, subtraction, multiplication and division and many other mathematical calculations. PHP have a very good support for mathematical processing. Here, we have some short listed mathematical functions for you. First of all, let’s see the list of important PHP math functions:- abs(), base_convert(), bindec(), ceil(), cos(), exp(), expm1(), floor(), fmod(), getrandmax(), hexdec(), is_finite(), is_infinite(), is_nan(), log(), log10(), log1p(), max(), min(), mt_getrandmax(), mt_rand(), mt_srand(), octdec(), pi(), pow(), round(), sin(), sqrt(), tan().

**Following is an explanation of some interesting PHP Math Functions –**

**PHP CEIL() Function**https://www.youtube.com/watch?v=fo1CGy3v7O8&t=26s

If you wants to figure out a number up to the nearest integer, then in this case you can follow **CEIL()** function. It will help you to fulfill your task.

Syntax = float ceil ( float $value )

**Program**:-

**PHP ABS() function**

The PHP ABS() function helps you to find out the absolute (positive) value of a number as an output.

Syntax= number abs ( mixed $number )

**Program**:-

**PHP FLOOR() Function**

The floor() function help you to figure out the number which is nearest to integer. In this function, we use a float or real number.

Syntax= float floor ( float $value )

**Program**:-

**PHP MAX() Function**

In case you want to find highest value, then you can use PHP** MAX() **function.

Syntax = max (array_values);

or

Max (val1, val2, ……);

**Program**:-

**PHP MIN() Function**

And, on the other hand, if you wants to find lowest value, then PHP math function have **MIN() Function.**

Syntax = min(array_values);

or

Min (val1, val2, ……);

Program:-

**PHP LOG() Function**

The log() function is used to return the natural logarithm of different numbers.

syntax= log(number,base);

**Program**:-

**PHP SQRT() Function**

*We also describe this concept in our YouTube Channel. Watch this on youtube –*https://www.youtube.com/watch?v=KQpIpZ5q7fU&t=14s

The sqrt() function used to returns the square root of a given number.

Syntax= float sqrt ( float $arg )

**Program**:-

**8.PHP DECBIN() Function**

The decbin() function used to converts decimal numbers into binary numbers. And it will returns binary number representation of given number as a string.

Syntax= string decbin ( int $num )

**Program**:-

**PHP BINDEC() Function**

If you want to convert numbers from binary to decimal, then **PHP BINDEC()** function will help you.

Syntax = num bindec ( string $binary_string )

**Program**:-

**PHP DECHEX() Function**

The dechex() function helps you to converts numbers from decimal into hexadecimal. And it will returns a hexadecimal number as a string.

Syntax= string dechex ( int $num )

**Program**:-

**PHP DECOCT() Function**

In case, you want to convert numbers from decimal to octal, then you should prefer **DECOCT() **function**. **It will returns a octal representation number as a string.

Syntax= string decoct ( int $num )

**Program**:-

**PHP BASE_CONVERT() Function**

The base_convert() function helps you to converts number from one base number to another base number. For example, you can convert hexadecimal numbers to binary numbers, hexadecimal numbers to octal numbers, binary numbers to octal numbers, octal numbers to hexadecimal numbers, binary numbers to decimal numbers etc.

Syntax= string base_convert ( string $num , int $frombase , int $tobase )

**Program**:-

Hope this blog help you in understanding the various math functions in PHP language.

For more such content subscribe to our YouTube channel – https://www.youtube.com/channel/UCcWR1IezEQynJnAETgK8g2w?sub_confirmation=1

Let us know if you have any thoughts/feedback on the blog in the comment section below.

Happy coding !

Usually I never comment on blogs but your article is so convincing that I never stop myself to say something about it. You’re doing a great job Man,Keep it up.

Hi,

Thank you so much for writing in. Such comments motivate us to write more valuable and useful content. Really appreciate it.

Feel free to find more such content at our YouTube channel – https://www.youtube.com/channel/UCcWR1IezEQynJnAETgK8g2w?sub_confirmation=1

Facebook page – https://www.facebook.com/pristinetechschool

Regards,

Pristine Tech School Team