create random string in 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); function RandomString()
{
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$randstring = '';
for ($i = 0; $i < 10; $i++) {
$randstring = $characters[rand(0, strlen($characters))];
}
return $randstring;
}
Also in PHP:
- count length of a string
- base64 to image
- find str in string php
- date math sql php
- display al errros php
- date("Y-m-d",
- comparacion cache laravel
- check if id is in key array php
- create laravel migration
- dump all variables twig
- errorLevel php no warnings
- eloquent update row response
- DB Seeder
- check method in laravel
- AWS HTTP error: SSL operation failed with code 1. OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed
- apt install php 7.4
- check array item exists php
- back route laravel
- array key exist
- artisan db:seed
- cakephp life cycle
- cache clear laravel command
- create new project laravel
- currenturl phpü