note 114086 added to function.uniqid
| From: | team at researchbib dot com | Date: | Fri, 10 Jan 2014 00:53:47 +0000 |
| Subject: | note 114086 added to function.uniqid | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-198179@lists.php.net to get a copy of this message | ||
The following is one example to get a random string class.
/**
* Description of RandomString
*
* @package
*/
class RandomString
{
/**
*
* @param int $length
* @return string
*/
static public function getRandom($length)
{
$randomData = base64_encode(
file_get_contents('/dev/urandom', false, null, 0, $length) .
uniqid(mt_rand(), true)
);
return substr(strtr($randomData, array('/' => '', '=' =>
'', '+' => '')), 0, $length);
}
}
----
Server IP: 72.52.91.14
Probable Submitter: 72.52.91.14
----
Manual Page -- http://php.net/manual/en/function.uniqid.php
Edit -- https://master.php.net/note/edit/114086
Del: integrated -- https://master.php.net/note/delete/114086/integrated
Del: useless -- https://master.php.net/note/delete/114086/useless
Del: bad code -- https://master.php.net/note/delete/114086/bad+code
Del: spam -- https://master.php.net/note/delete/114086/spam
Del: non-english -- https://master.php.net/note/delete/114086/non-english
Del: in docs -- https://master.php.net/note/delete/114086/in+docs
Del: other reasons-- https://master.php.net/note/delete/114086
Reject -- https://master.php.net/note/reject/114086
Search -- https://master.php.net/manage/user-notes.php