$pwd = $this->generateRandomString($length = 8); error
function generateRandomString($length = 25) {
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters);
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, $charactersLength - 1)];
}
return $randomString;
}
//usage
$myRandomString = generateRandomString(5);function rand_str() {
$characters = '0123456789-=+{}[]:;@#~.?/>,<|\!"£$%^&*()abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$randomstr = '';
for ($i = 0; $i < random_int(50, 100); $i++) {
$randomstr .= $characters[rand(0, strlen($characters) - 1)];
}
return $randomstr;
}
Also in PHP:
- Y-m-d H:i:s O format
- exception is thrown php
- Laravel store multiple files
- database seeding
- array_key_exists vs isset
- Laravel users_email_unique
- artisan command for clearing cache
- check strinh in php
- 500 server error laravel 7
- ADD OR ON SWITCH CASE PHP
- check codeigniter version of a project
- Type error: Argument 1 passed to Illuminate\Database\Grammar::parameterize()
- creating a laravel project with composer
- array splice php
- STING INCLUDSE A CARACTHER PHP
- append variable into string php
- debug bar laravel print array
- config cache clear in laravel
- associative array reverse php
- array hass a key in php
- file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages 3
- check if there is string in string php
- enable php errors
- array key exists php