hlstriker Posted April 26, 2007 Share Posted April 26, 2007 Hi, can someone tell me how to generate about 8-10 chars worth of random gibberish and add it to a string please? Example: string = coolname; gibberish = generating(gibberish!); newstring = string . gibberish; I really don't know how to generate the gibberish so I just made it up in that example. Quote Link to comment Share on other sites More sharing options...
LazyJones Posted April 26, 2007 Share Posted April 26, 2007 So many nifty solutions for this one, here's one http://www.tutorialized.com/tutorial/PHP-Random-String-Generator/13903 *couch*google*couch* Quote Link to comment Share on other sites More sharing options...
Barand Posted April 26, 2007 Share Posted April 26, 2007 or if you just want a-z A-Z, <?php function gibberish($size) { $base = array_merge(range('a','z'), range('A','Z')); shuffle($base); return join('', array_slice($base, 0, $size)); } echo gibberish(; ?> Quote Link to comment Share on other sites More sharing options...
taith Posted April 26, 2007 Share Posted April 26, 2007 <? function randomkeys($length){ $pattern = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; for($i=0;$i<$length;$i++) $key .= $pattern{rand(0,62)}; return $key; } ?> 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.