Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php generate random string fixed length

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);
Comment

PREVIOUS NEXT
Code Example
Php :: get term thumbnail 
Php :: debug wordpress errors 
Php :: laravel table data types 
Php :: how to set ist in php 
Php :: php iterate folder 
Php :: wp get post content by id 
Php :: open php.ini in ubuntu 
Php :: how to create cookie in php 
Php :: twig first letter uppercase 
Php :: wp mail 
Php :: php code to convert to small letter 
Php :: twig concat string 
Php :: laravel foreach loop index 
Php :: php form action self 
Php :: php.ini settings 
Php :: laravel carbon today date format 
Php :: npm watch laravel 
Php :: laravel clear everything 
Php :: php numbers from 1 to 100 array 
Php :: pusher-php-server laravel 
Php :: html input date php date today 
Php :: why use ob_start() in php 
Php :: laravel mix purge css 
Php :: typo3 debug 
Php :: composer create project laravel 7 
Php :: laravel session flash 2020 
Php :: parent directory in php 
Php :: laravel env 
Php :: apache not executing php 
Php :: yii2 where in 
ADD CONTENT
Topic
Content
Source link
Name
2+8 =