Organizational Research By

Surprising Reserch Topic

how to create a random string using php


how to create a random string using php  using -'php,string,random'

I know that the rand function in PHP generates random integers, but what is the best way to generate a random string such as:

Original string, 9 chars

$string = 'abcdefghi';


Example random string limiting to 6 chars

$string = 'ibfeca';


UPDATE: I have found tons of these types of functions, basically I'm trying to understand the logic behind each step.

UPDATE: The function should generate any amount of chars as required.

Please comment the parts if you reply.
    

asked Sep 10, 2015 by MickiWaterho
0 votes
13 views



Related Hot Questions

16 Answers

0 votes
NULL
answered Sep 10, 2015 by EdytheMussen
0 votes
NULL
answered Sep 10, 2015 by CatherineVvu
0 votes
NULL
answered Sep 10, 2015 by HilKingsley
0 votes
NULL
answered Sep 10, 2015 by PhiW61
0 votes
NULL
answered Sep 10, 2015 by MurJuarez
0 votes
NULL
answered Sep 10, 2015 by HITRalfmeml
0 votes
NULL
answered Sep 10, 2015 by MartyBetheld
0 votes
NULL
answered Sep 10, 2015 by RanKifer
0 votes
NULL
answered Sep 10, 2015 by FreemanElkin
0 votes
NULL
answered Sep 10, 2015 by BerylIsrudnj
0 votes
NULL
answered Sep 10, 2015 by MargaritQYV
0 votes
NULL
answered Sep 10, 2015 by HilBleasdal
0 votes
NULL
answered Sep 10, 2015 by Shanna36Cgwr
0 votes
NULL
answered Sep 10, 2015 by VicOss
0 votes
NULL
answered Sep 10, 2015 by MerPriestle
0 votes
NULL
answered Sep 10, 2015 by GerWhinham

...