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 WildaBannerm
0 votes
15 views



Related Hot Questions

16 Answers

0 votes
NULL
answered Sep 10, 2015 by ShermanMessanu
0 votes
NULL
answered Sep 10, 2015 by EmmettUXDwv
0 votes
NULL
answered Sep 10, 2015 by VaughnDavids
0 votes
NULL
answered Sep 10, 2015 by OrlandoVMGO
0 votes
NULL
answered Sep 10, 2015 by JeannaWeekes
0 votes
NULL
answered Sep 10, 2015 by AngelesMSOG
0 votes
NULL
answered Sep 10, 2015 by BerthaWhatle
0 votes
NULL
answered Sep 10, 2015 by Rgjjilda
0 votes
NULL
answered Sep 10, 2015 by JenGlasgow
0 votes
NULL
answered Sep 10, 2015 by ZackBoylenpg
0 votes
NULL
answered Sep 10, 2015 by IslaStonorpt
0 votes
NULL
answered Sep 10, 2015 by DODWal
0 votes
NULL
answered Sep 10, 2015 by KaceyMaselsx
0 votes
NULL
answered Sep 10, 2015 by BrianService
0 votes
NULL
answered Sep 10, 2015 by CorYUTN
0 votes
NULL
answered Sep 10, 2015 by MelissaRupp

...