Random Numbers And Letters Example
Php / / July 04, 2021
This code in PHP, tea will generate a number and one letter randomly. It is very good to do giveaways, or do things random.
The rand () function is used; in order to numbers, and chr (); u ord (); to show a lyrics from some Random number according to the ASCII table.
You can configure the Variables, to adjust the range of generation so much of lyrics like number.
Variables are configured to generate letters from D to Y. And the generated number it would be between 1 and 1000
Code:
# Example to generate a number and letter and display it
# Courtesy of ExampleDe.com
//Variables
$ FromLetter = "d";
$ UpLetter = "y";
$ FromNumber = 1;
$ UntilNumber = 1000;
$ randomLetter = chr (rand (ord ($ FromLetter), ord ($ ToLetter)));
$ randomNumber = rand ($ FromNumber, $ ToNumber);
threw out "The random letter generated is: ". $ randomLetter."
";
threw out "The random number generated is: ". $ randomLetter."
";
threw out "
Example taken from Example of. Com";
?>