← CodePrimer
PHP
Beginner
Basics
PHP math helpers
How do I do min/max/round/random in PHP?
Built-in math functions.
<?php
echo min(3, 8, 1);
echo max(3, 8, 1);
echo abs(-12);
echo sqrt(49);
echo round(4.6);
echo rand(1, 10);
Notes
is_int / is_float / is_numeric help validate numbers.
Keywords: math · min · max · round · rand · abs · sqrt
Related
HTML
HTML headings h1–h6
How do I create page headings?
CSS
Three ways to apply CSS
What are inline, internal, and external CSS?
PHP
Embed PHP inside HTML
How do I mix PHP and HTML?
HTML
Paragraphs and line breaks
How do I break text into paragraphs?
CSS
CSS box model
Why is my element wider than expected?
PHP
PHP comments
How do I write comments in PHP?