Zwake
11-16-2011, 09:06 PM
Hey quick question. I want to concatenate the 5 random values of an array into a variable. Here is what i got:
$abc= array("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l",
"m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z");
for ($i=0;$i>5;$i++){
$s .= $abc[rand(0,25)];}
echo $s;
So for example when i echo $s it would be 5 random letters stored in $s.
I think i know where the problem is, i think i cant say .= to add the random letter into the null variable s. How do i do this in php? I know in Javascript its += but that doesnt work either. Thanks.
$abc= array("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l",
"m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z");
for ($i=0;$i>5;$i++){
$s .= $abc[rand(0,25)];}
echo $s;
So for example when i echo $s it would be 5 random letters stored in $s.
I think i know where the problem is, i think i cant say .= to add the random letter into the null variable s. How do i do this in php? I know in Javascript its += but that doesnt work either. Thanks.