create random string 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);//generates 13 character random unique alphanumeric id
echo uniqid();
//output - 5e6d873a4f597<?php
function RandomString()
{
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$randstring = '';
for ($i = 0; $i < 10; $i++) {
$randstring = $characters[rand(0, strlen($characters))];
}
return $randstring;
}
RandomString();
echo $randstring;
Also in PHP:
- Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:
- create 5 rendom charactors in php
- Main features of php
- Call to undefined method Illuminate\Session\Store::set()
- array deduplicate in php
- Library not loaded: /usr/local/opt/icu4c/lib/libicuio.64.dylib Referenced from: /usr/local/bin/php
- Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /var/www/service.ramondettiforwarding.com/lib/vendor/guzzlehttp/guzzle/src/Middleware.php on line 3432184904
- add page nos. to existing pdf in php
- buddypress author link
- base 64 decode in php
- eloquent get query log
- Increase execution time of server
- ->sale_price
- decode base64 with key php
- AUTO TRANSFER OF DATA FROM SYBASE TABLE TO PHPMYSQL TABLE
- count number of characters in a string in php
- check if index of array exists php
- codeigniter last insert id example
- delete config cache javascript
- blank admin page magento 2.3
- create a new laravel folder
- Delete Query with Where Condition in Codeigniter
- consolelog php response
- am pm time format in php