PHP Strong Random Number and String Generator

Rate this post

PHP Strong Random Number and String Generator

Here are simple PHP code samples to uniq generate random all the number and all the strings Based in PHP.PHP Strong Random Number and String Generator Examples

PHP random string generator Example

Generate simple random numbers Most integer Like as between 1 and 1000

$mynumber = rand(1,1000);

Generate a random integer Example

Using mtrand() method or function for better generate random number all generation

$mynumber = mt_rand(1,1000);

Generate a random string A-Z, 0-9 in PHP

Generate a unique identification combination of simple all numbers and all letters. Note Works with PHP5 or more and higher versions.

Read Also:  how to create quiz in php and mysql? (4 Questions)

$mynumberunique = uniqid();

Generate a random string A-Z, 0-9 in PHP using MD5

Using md5() function and uniqid() using function to make simple the string data more complex data. md5() function generally used secure based generates 32 character high security long string automatically. Note : uniqid() function works only with PHP5 or more versions or higher.

Free Live Chat for Any Issue

$mynumbermd5_unique = md5(uniqid());

How to Securely Generate Random Strings and Integers in PHP Example

Generate simple random string from a here (live24u my hot website) given string. Randomly and dificult way to shuffling a each given string.

Read Also:  install and/or enable a php accelerator (highly recommended)

$mystring = "live24u my hot website";
$newrandomString = str_shuffle($mystring);

Generate simple random number based using time() method or function. The number same changes settimeout every second changes. This returns num the current this returns unix timestamp.

$my_time = time();