Breaking

PHP Math Functions

 The math functions can handle values within the range of integer and float types.


List of all PHP Math functions

Every PHP developer must know these PHP math functions such as pi, min, max, rand, ceil, floor, rand, is_nan.

        <?php echo pi(); ?>

        <h2>Find minimum value from array</h2>
        <?php
        echo min(array(3, 6, 2, 9));  // Output 2
        ?>

        <h2>Find maximum value from array</h2>
        <?php
        echo max(array(3, 6, 2, 9));  // Output 9


        echo "<br> Find height intiger number";
        echo ceil(4.3); // Output 5

        echo "<br> Find floor intiger number";
        echo floor(4.3); // Output 4

        echo "<br> Find absolute intiger number";
        echo abs(-123); // Output 123


        echo "<br> Find a random intiger number";
        echo rand(); 

        echo "<br> Find a random intiger number between 1 to 50";
        echo rand(1, 5); 

        echo "<br> Find a is wheather nan or not";
        echo is_nan(2); 
        ?>





No comments:

Powered by Blogger.