create random unique string
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);<?php
// online code for creating alphanumeric in php
// this will generate 6 charactor, you can create as many just change the 6 from code
$pass = substr(str_shuffle("0123456789abcdefghijklmnopqrstvwxyz"), 0, 6);
echo $pass;
//output : 17w2y8
?>
Also in PHP:
- create DateTime from timestamp php
- current time in php
- date du jour en php
- Undefined variable: subcopy laravel mail
- How do you clear cache in Laravel?
- cart icon in woocommerce
- array search by key in php
- TIME 24 FORMAT PHP
- dequeue recaptcha wordpress
- check string exist in php
- associative array example
- apache php default date format 4 digits
- custom time php function
- cache:clear php artisan
- acf auto increment field
- check if word exist in string
- DATE fromat H:i j M Y
- clear all cache laravel server
- count string length in php
- change from all caps to sentence case in php
- date format php datetime
- console.log from functions php
- array key xists
- extend maximum execution tim e