Docs/PHP/Numbers & Math

PHP Numbers

Functions

  • abs(), round(), ceil(), floor()
  • max(), min()
  • rand(), mt_rand()
  • sqrt(), pow()
  • number_format()
  • intval(), floatval()
  • is_numeric(), is_int()
index.php
Try It →
<?php
echo "abs(-15): " . abs(-15) . "
";
echo "round(4.567, 2): " . round(4.567, 2) . "
";
echo "ceil(4.1): " . ceil(4.1) . "
";
echo "floor(4.9): " . floor(4.9) . "
";
echo "max(3,7,2,9): " . max(3,7,2,9) . "
";
echo "rand(1,100): " . rand(1, 100) . "
";
echo "sqrt(144): " . sqrt(144) . "
";
echo "pow(2,8): " . pow(2, 8) . "
";
echo "number_format(1234567.89): " . number_format(1234567.89, 2, ",", ".") . "
";
echo "is_numeric('42'): " . (is_numeric("42") ? "true" : "false") . "
";
echo "PI: " . M_PI;
?>