create a random string in php
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:
- expire Cache Manually laravel
- display errors in php
- codeigniter id of last insert
- check if contain keyword php
- clear cache in laravel putty
- HOW TO GET LAST INSERTED ID FROM TABLE IN SQL IN CODEIGNITER
- check if in array key php
- cache laravel
- check key in array php
- date funciton
- $join is_array() in code
- create laravel 5.8 project using composer
- download laravel 8.x
- artisan clean cache
- error e all php
- check type of php
- count rows mysql limit php
- buat table seeder laravel
- @if(Auth::user()->id(1))
- date math sql php
- PHP Html-Optimizer on github
- buddy group hide notice join
- display errors on
- filteredduplicata php