Bitrix Site Manager

RandString

string
RandString(
 int length = 10
)

The function RandString returns a string of the specified length consisting of random symbols. Random symbols can be Latin letters and digits. For example, the function can be used to generate passwords.

Parameters

ParameterDescription
length Length of the resulting random string.

Example



<?
$new_password = RandString(7);
echo "New password: ".$new_password;
// prints the string "New password: fK4ftTP"
?>