note 105196 added to function.str-shuffle
| From: | Anonymous at osu1 dot php dot net | Date: | Tue, 02 Aug 2011 14:35:55 +0000 |
| Subject: | note 105196 added to function.str-shuffle | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-182103@lists.php.net to get a copy of this message | ||
If using str_shuffle to get random passwords, use str_repeat to allow a character to appear multiple
times:
<?php
substr(str_shuffle(str_repeat('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789',5)),0,5);
?>
This will take the all-character string, multiply it 5 times, shuffle it, and return the first 5
characters of the shuffle.
----
Server IP: 69.147.83.197
Probable Submitter: 194.183.77.29
----
Manual Page -- http://www.php.net/manual/en/function.str-shuffle.php
Edit -- https://master.php.net/note/edit/105196
Del: integrated -- https://master.php.net/note/delete/105196/integrated
Del: useless -- https://master.php.net/note/delete/105196/useless
Del: bad code -- https://master.php.net/note/delete/105196/bad+code
Del: spam -- https://master.php.net/note/delete/105196/spam
Del: non-english -- https://master.php.net/note/delete/105196/non-english
Del: in docs -- https://master.php.net/note/delete/105196/in+docs
Del: other reasons-- https://master.php.net/note/delete/105196
Reject -- https://master.php.net/note/reject/105196
Search -- https://master.php.net/manage/user-notes.php