Hamlets666 Posted December 14, 2006 Share Posted December 14, 2006 Stupid question : How to get random letter (a-z) in to varuable $x ? Quote Link to comment Share on other sites More sharing options...
craygo Posted December 14, 2006 Share Posted December 14, 2006 Just a little search on google came up with this[code]$spoon = mt_rand(0, 25);$alphabetSoup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';$randomLetter = $alphabetSoup[$spoon];echo $randomLetter;[/code]Gotta love googleRay Quote Link to comment Share on other sites More sharing options...
taith Posted December 14, 2006 Share Posted December 14, 2006 that'll give you a string of random letters to any length you want[code]function randomkeys($length){ $pattern = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; for($i=0;$i<$length;$i++) $key .= $pattern{rand(0,62)}; return $key;}$x=randomkeys(1);echo $x;[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.