create random set of strings PHP
//generates 13 character random unique alphanumeric id
echo uniqid();
//output - 5e6d873a4f597function 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();
Also in PHP:
- Adding code to header tag php website
- cancel stripe subscription php
- day of the week th usig php
- create project laravel
- check if string has a certain string php
- carbon format date in laravel
- Get the number of days between two dates in PHP
- add google analytics to website laravel
- Generate Laravel Migrations from an existing database
- date to timestamp ph
- Remove values from select list based on condition
- built in functions in php for uppercase
- create new laravel project
- TreeBuilder::getRootNode()" before creating the root node is not supported, migrate to the new constructor signature instead.
- connexion à la base de donnée microsoftsqlserver avec php
- Carbon\Carbon::today()->format('Y-m-d') in blade
- You want to develop a Laravel application on your Windows machine. For this, you installed the Laravel framework on your system. In which of the following scenarios, Laravel will not run on your system?
- advanced custom field repeater
- create project laravel 6 using composer
- clear cache laravel in server
- Composer detected issues in your platform: Your Composer dependencies require a PHP version but php is higher
- REMOTE_ADDR php get server address not user ip
- add 10 days to date in php
- command line how to create folder and file php