Mathematics

PHP has a great number of mathematical functions ready for you to use, as well as several constants for popular numbers so you do not have to calculate them yourself.

Nearly all of the functions can be grouped into three areas: rounding, randomisation, and conversion. Naturally some of these functions are only useful to people with a specific interest in mathematics, but, happily, the majority of these functions come into the conversion group.

 

Want to learn PHP 7?

Hacking with PHP has been fully updated for PHP 7, and is now available as a downloadable PDF. Get over 1200 pages of hands-on PHP learning today!

If this was helpful, please take a moment to tell others about Hacking with PHP by tweeting about it!

Next chapter: Rounding >>

Previous chapter: Converting from components

Jump to:

 

Home: Table of Contents

Copyright ©2015 Paul Hudson. Follow me: @twostraws.