auto generatd number mixed with strings php
function generateRandomString($length = 10) {
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters);
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, $charactersLength - 1)];
}
return $randomString;
}
Output the random string with the call below:
// Echo the random string.
// Optionally, you can give it a desired string length.
echo generateRandomString();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:
- append variable into string php
- date format in ph
- MySQL integer field is returned as string in PHP
- artisan run seeder
- exposé tinker laravel
- Route pattern cannot reference variable name more than once. laravel
- current php date
- create a laravel project php 8
- DateTime::add() php
- __toString() must not throw an exception, caught Error: Call to a member function diffForHumans() on null
- PHP Fatal error: Uncaught Error: Call to undefined function mcrypt_encrypt()
- creating thumbnail in codeigniter
- datetime format php datetime
- defaultStringLength laravel
- case php try catch
- date show year first php
- check key exists in array in php
- clear memcache laravel'
- base64 in php
- Delete Query with Where Condition in Codeigniter
- Modularizing laravel 8.0
- drupal 8 entity_view
- filter elementor
- Exception.php