Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • What is rand() function in php?

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 110
    Comment on it

    The rand() function is used to generate a random integer number.

    How to use rand() function?

    Syntax of rand() function:

    rand(); or rand(min,max);

    min:- min is use for Specifieing the lowest number that is retuned. Default min is 0.
    max:-max is use for Specifieing the highest number that is retuned.

    You can see below example of rand() function.

    <?php
    //here call rand() finction
    echo(rand() . "<br>");
    //here call rand() with parameter finction
    echo(rand(10,100));
    ?>
    

    There are following output come of above example:

    1-When print the only rand () then, result will come

    1694893849
    

    2-When print the only rand(10,100) then, result will come

    53 
    

    Note:Both result will be change when page will get refresh

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: