note 79352 added to function.rand
| From: | Lcf dot vs at osu1 dot php dot net | Date: | Thu, 22 Nov 2007 13:15:18 +0000 |
| Subject: | note 79352 added to function.rand | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-132482@lists.php.net to get a copy of this message | ||
méthode de génération de codes aléatoires à plusieurs dimensions:
$list = 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", "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", "0",
"1", "2", "3", "4", "5", "6",
"7", "8", "9");
for ($y=0; $y<=$nombre_de_codes_choisi ; $y++)
{
for ($x=0; $x<=50; $x++)
{
$tbl[$x][$y] = $list[rand(1,62)];
}
}
for ($x=0; $x<=50; $x++)
{
$code1 .=$tbl[$x][1];
$code2 .=$tbl[$x][2];
$code3 .=$tbl[$x][3];
etc...
----
Server IP: 217.174.196.197
Probable Submitter: 194.78.197.95
----
Manual Page -- http://www.php.net/manual/en/function.rand.php
Edit -- https://master.php.net/note/edit/79352
Del: integrated -- https://master.php.net/note/delete/79352/integrated
Del: useless -- https://master.php.net/note/delete/79352/useless
Del: bad code -- https://master.php.net/note/delete/79352/bad+code
Del: spam -- https://master.php.net/note/delete/79352/spam
Del: non-english -- https://master.php.net/note/delete/79352/non-english
Del: in docs -- https://master.php.net/note/delete/79352/in+docs
Del: other reasons-- https://master.php.net/note/delete/79352
Reject -- https://master.php.net/note/reject/79352
Search -- https://master.php.net/manage/user-notes.php