डिप्लोमा इन ऑफिस मैनेजमेंट एण्ड अकाउटिंग

डिप्लोमा इन ऑफिस मैनेजमेंट एण्ड अकाउटिंग

Full Stack Web Development with Laravel

Full Stack Web Development with Laravel

Affiliate Program

Affiliate Program

PHP math functions

  1. abs(n)
    Return absolute value
  2. base_convert(n, from, to)
    Convert a number from one base to another
  3. ceil(n)
    Round up number nearest integer
  4. floor(n)
    Round down a number nearest integer
  5. sin(n)
    Return sine of a number
  6. cos(n)
    Return cosine of a number
  7. tan(n)
    Return tangent of a number
  8. hypot(b, h)
    Calculate the hypotenuse  of right angle triangle
  9. log(n)
    Return natural logarithm of a number
  10. log10(n)
    Return the base 10 logarithm of a number
  11. max(arg1, arg2)
    Return max value number from an array
  12. min(arg1, arg2)
    Return min value number from an array
  13. mt_rand(from, to)
    Generate a random number it is fast than rand
  14. pi()
    Return pi value
  15. pow(base, exponent)
     Return power of a number
  16. rand(from, to)
    Return random value
  17. round(n)
    Round a floating-point number
  18. sqrt(n)
    Return square root of a given number


example

<?php 

echo "abs <br>";
echo abs(-90);
echo "<br>";


echo "base_convert <br>";
echo base_convert(5, 10, 2);
echo "<br>";


echo "ceil <br>";
echo ceil(1.2);
echo "<br>";


echo "floor <br>";
echo floor(1.9);
echo "<br>";


echo "sin <br>";
echo sin(90);
echo "<br>";


echo "cos <br>";
echo cos(90);
echo "<br>";


echo "tan <br>";
echo tan(90);
echo "<br>";


echo "hypot <br>";
echo hypot(2, 3);
echo "<br>";


echo "log <br>";
echo log(10);
echo "<br>";


echo "log10 <br>";
echo log10(10);
echo "<br>";


echo "max <br>";
echo max([1,2,3,4,5]);
echo "<br>";


echo "min <br>";
echo min([1,2,3,4,5]);
echo "<br>";


echo "mt_rand <br>";
echo mt_rand(1,1000);
echo "<br>";


echo "pi <br>";
echo pi();
echo "<br>";


echo "pow <br>";
echo pow(2, 3);
echo "<br>";


echo "rand <br>";
echo rand(1, 1000);
echo "<br>";


echo "round <br>";
echo round(3.12);
echo "<br>";


echo "sqrt <br>";
echo sqrt(9);
echo "<br>";

?>
© 2016 - 2023, All Rights are Reserved.