Security\Random::bytes

public bytes ([mixed $len])

Generates a random binary string The Random::bytes method returns a string and accepts as input an int representing the length in bytes to be returned. If $len is not specified, 16 is assumed. It may be larger in future. The result may contain any byte: “x00” - “xFF”.

$random = new \Phalcon\Security\Random();

  $bytes = $random->bytes();
  var_dump(bin2hex($bytes));
  // possible output: string(32) "00f6c04b144b41fad6a59111c126e1ee"
doc_Phalcon
2016-10-16 09:56:30
Comments
Leave a Comment

Please login to continue.