What is use of random_bytes() in PHP?

EvgeniaAnd
Written by EvgeniaAnd

Posted On: Jan 09, 2019

 

    1 Answer Written

  •  EvgeniaAnd
    Posted by Sneha Padmakar Patil

    random_bytes() function in PHP is used to generate cryptographically secure pseudo-random bytes.

    Syntax:

    String random_bytes ( int $length )
    

    Usage

    $length = random_bytes('4'); 
      
    //Print the reult and convert by binaryhexa 
    var_dump(bin2hex($length)); 
    
    

Please Login or Register to leave a response.

Related Questions