note 57592 added to function.rand
| From: | expertphp at yahoo dot com | Date: | Sat, 08 Oct 2005 01:50:48 +0000 |
| Subject: | note 57592 added to function.rand | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-96654@lists.php.net to get a copy of this message | ||
Generate custom random characters. By default, allwed characters are [0-9][a-z][A-Z]. Optional, you
can generate only with numeric or/and not numeric characters.
For more informations, please visit: http://expert.no-ip.org/?free=Random&class
<?php
require_once 'Random.php';
// generate 3 default random characters
$obj1 = new Random;
echo $obj1->get(3)."<br />\n";
// generate 4 custom [abcdefgh] random characters
$obj2 = new Random("abcdefgh");
echo $obj2->get(4)."<br />\n";
// generate 6 default random characters
// with only numeric and not numeric character(s)
// this option is useful to generate a custom password
$obj3 = new Random(false, true, true);
echo $obj3->get(6)."<br />\n";
// generate another 12 random characters with $obj3 options
echo $obj3->get(12);
?>
Output results :
0x9
ebgc
aBAB0d
5X6Sfo0Cui6J
----
Manual Page -- http://www.php.net/manual/en/function.rand.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+57592
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57592&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57592&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57592&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57592&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57592&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57592&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57592&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+57592&report=yes
Search -- http://master.php.net/manage/user-notes.php