php random string

Solutions on MaxInterview for php random string by the best coders in the world

showing results for - "php random string"
Flavien
29 Nov 2017
1function generateRandomString($length = 25) {
2    $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
3    $charactersLength = strlen($characters);
4    $randomString = '';
5    for ($i = 0; $i < $length; $i++) {
6        $randomString .= $characters[rand(0, $charactersLength - 1)];
7    }
8    return $randomString;
9}
10//usage 
11$myRandomString = generateRandomString(5);
Ronan
31 Jan 2021
1//generates 13 character random unique alphanumeric id
2echo uniqid();
3//output - 5e6d873a4f597
Kelly
12 Nov 2016
1function generateRandomString($length = 10) {
2    $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
3    $charactersLength = strlen($characters);
4    $randomString = '';
5    for ($i = 0; $i < $length; $i++) {
6        $randomString .= $characters[rand(0, $charactersLength - 1)];
7    }
8    return $randomString;
9}
10
11Output the random string with the call below:
12
13// Echo the random string.
14// Optionally, you can give it a desired string length.
15echo generateRandomString();
Lorenzo
25 Jan 2019
1function rand_str() {
2    $characters = '0123456789-=+{}[]:;@#~.?/&gt;,&lt;|\!"£$%^&amp;*()abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
3    $randomstr = '';
4    for ($i = 0; $i < random_int(50, 100); $i++) {
5      $randomstr .= $characters[rand(0, strlen($characters) - 1)];
6    }
7    return $randomstr;
8  }
Luis
22 Jan 2019
1<?php 
2    $random = substr(md5(mt_rand()), 0, 7);
3    echo $random;
4?>
Valery
19 Nov 2017
1<?php
2    function RandomString()
3    {
4        $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
5        $randstring = '';
6        for ($i = 0; $i < 10; $i++) {
7            $randstring = $characters[rand(0, strlen($characters))];
8        }
9        return $randstring;
10    }
11
12    RandomString();
13    echo $randstring;
queries leading to this page
php generate a random stringphp random character generatorget a random string phpget random char in phpphp generate random coderandom sting phprandom character generator phprand string php functionphp random element of stringgenerate random stringin phpgenerate random sring phprandomstring phpphp random code generatorget a random letter phpphp random number stringphp generate random stringrandom number and characters phphow to generate random string with phpphp random string of charactershow to generate random letter in phpgenerate a random string phpphp random stringrandom string generater phpphp random 4 character stringphp generate random string with numbers and lettershow to generate random 64 digit alphanumeric verification code in phpphp generate a single character random numberrandom number string phpalphanumeric character generator phpphp str randompgp gernate random stringphp how to generate random stringchartres random string phpphp 8 create random string alphanumericalphabet and numeric random phpphp generate random characterrandom number and letter phprandom character generator in phphow to generate random characters in phpgenerate random number to include text charater in phpgenerate 5 letter code phprandom string method phpphp random string methodphp generate random string alphanumericstr random phpphp use random charphp generate random string with lengthphp random string 8 charactersgenerate alphanumeric string phpphp random characterphp random string fixed lengthphp generate random string of charactersrandom string in phpphp random alphanumeric stringphp function to generate a random 10 character stringphp best function to generate random stringrandom char in phprandom string phpphp generate unique random alphanumeric string laravelprogram generate random alphabets using phpphp random string generatorgenerate random string of symbols phprandom string generator phphow to create random alphanumeric code in phprandom string with numbers and letters phprandom function in php for stringphp generate random string of fixed lengthhow to generate a random string in phprandom str phpcreare a random string in phpphp str radom 4 charactersphp function to generate random stringphp random string with numbers and lettersgenerate string phpphp generate random string 10php generate random string alphanumeric api keyrandom text number generator phpcreate random alphanumeric string phphow to make a random string phpgenerate unique string with all symbols in phprandom letter phphow to make random string in phpphp random strnrandom number and character generator in phpphp randome stringrandom string of 13 chars phpphp random string generate random letter and number phpphp 18 random character generatorcreate 64 digit random string phpphp randomstring12 digit alphanumeric random number generator phprandom code generator using phpalphabet generator phpphp generate random strgemerate random string phpstring generator phphow to make a random number generator phpphp create random number stringphp random stringsphp generate random 7 alfanumeric stringrandom string not working in phpphp random from stringstop gen random string phpphp code to generate random text stringphp create random stringphp randon stringphp create random string capetal and integerphp random strrandom srting using php using letters and numbersphp generate random number fixed lengthhow to generate random string in phpcreaterandom character phpstr random with list of chars phpgenerate random alphanumeric string laravelphp function to generate random string of numbershow to generate random string of numbers phpphp random string genphp generate random alphanumeric stringcreate random string phprandom php code generatorphp random generatorehow to generate random numbers and letters in phpphp random word generatorrandom number and string generator phpget randome string from a string in phpcreate random set of strings phpget random string in phpphp random string of lengthb 50get random string phphow to create a random string as id on phpgenerate random 8 string code in phpphp create randomg string namrandom charat generator phprandstr phprandom alphanumeric in phpgenerate 4 digit random string in phpmake random string phprandom id with 5 length phpphp random string php generate random string of 9 charactersphp generate random n charactersgenerate random number of text and number phpphp generate random string from charactersgenerate random string in phpunique alphanumeric code generator phphow to generate random character and numbers in phpphp generate stringrandom generator number and letter phpphp random function stringphp generate alphanumeric random stringphp random caractersphp generate random string on different pagegenerate string with length phpphp generate random stinggenerate random characters php for password with specialphp random alphanumericphp random string generaterandomstring in phpphp simple random stringphp random string without certain charactersphp random 5 digit stringgenerate random string with numbers and letters phpphp get random 10 characters from stringphp random string generator functionphp generate random string fixed lengthradnom string phpgenerate alphanumeric characters phpcreate randome string phphow to generate random alphanumeric string in phprand php stringgeneraterandomstring phpfunction number php alphanumeric randomphp generate string of random charactersrandom alphanumeric generator phpphp generate random string and numbergenerate random sctring in phpphp generate rendom stringphp generate big random hashrandom number and letter generator phphow to generate random string using phplaravel str random without specific characterphp generate random wordsphp random number mix of number and characterfunction generate random stringalphanumeric random generator phprandom generator phpphp gen random stringphp random string generatestr text random in phprndom string gen phpphp rando num alpharandom string generator in phprandom text phprandom code generator phprandom characters string phprandom strring phpphp get random stringhow to generate random string of aplhanumeric phpphp randomize creation stringunique string generator in phpphp generate save random stringhow to generate fixed length random string in phprandom php with lettersphp str randphp 16 random string generatorrandom character phplaravel generate random charsrand alphanumeric generate for 6digit in phpphp random letterphp rando 2c stringcreate random alphanumeric phpphp random string generatrrandom string number phpgenerate unique string in phprandom sentence phprandom char phpgenerate alphanumeric random number in phprandom strings in phphow do i make a random string in phpphp random unic alphanumeric codehow to generate random string id in phpgenerate random alphanumeric password in phprandom string generator in php phpphp random string how to generate random letters and numbers phpphp show random letterphp random string of length 5php create a random string over 99 char longgenerate random text and character in phpgenerate random string pphrandom letters phprandom charackter in phpphp strong randongphp random string from stringalphanumeric rand phprandomcode in phpmake random string and number phprandom php stringrandom text generator in phpstring random phprandom string and characters gen phpphp generate unique random alphanumeric stringgenerate random string with special characters phpgenrate random string phpphp generate random number stringget random text in phpgenerate randon text phpphp random string uppercase and numberhow to get random letter in phprandom gnrate string phpphp random letter generatorgenerate random string phpgenerate random string phprandom text generator phprandom string in phprandom alphabet letter generator phprandom string generator for phpgenerate random characters in phpphp randomly generate a characterphp randomise textphp random alphanumeric codephp random charactersphp get random letterphp random string and numberphp random string