note 102618 added to function.rand

[email protected] Thu, 24 Feb 2011 11:26:20 -0800
Newsgroups php.notes
Message-ID <[email protected]>
Much easier way to generate random string of numbers and letters:

<?php
$n = rand(10e16, 10e20);
echo base_convert($n, 10, 36);
?>

This generates strings of about 11 characters. Experiment with the range for rand() if you want shorter or longer.
----
Server IP: 195.114.0.19
Probable Submitter: 79.186.58.203
----
Manual Page -- http://www.php.net/manual/en/function.rand.php
Edit        -- https://master.php.net/note/edit/102618
Del: integrated  -- https://master.php.net/note/delete/102618/integrated
Del: useless     -- https://master.php.net/note/delete/102618/useless
Del: bad code    -- https://master.php.net/note/delete/102618/bad+code
Del: spam        -- https://master.php.net/note/delete/102618/spam
Del: non-english -- https://master.php.net/note/delete/102618/non-english
Del: in docs     -- https://master.php.net/note/delete/102618/in+docs
Del: other reasons-- https://master.php.net/note/delete/102618
Reject      -- https://master.php.net/note/reject/102618
Search      -- https://master.php.net/manage/user-notes.php