Hamlets666 Posted December 14, 2006 Share Posted December 14, 2006 Stupid question : How to get random letter (a-z) in to varuable $x ? Link to comment https://forums.phpfreaks.com/topic/30648-random-letter/ 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 Link to comment https://forums.phpfreaks.com/topic/30648-random-letter/#findComment-141202 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] Link to comment https://forums.phpfreaks.com/topic/30648-random-letter/#findComment-141210 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.