1function generateRandomString($length = 25) {
2 $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
3 $charactersLength = strlen($characters);
4 $randomString = '';
5 for ($i = 0; $i < $length; $i++) {
6 $randomString .= $characters[rand(0, $charactersLength - 1)];
7 }
8 return $randomString;
9}
10//usage
11$myRandomString = generateRandomString(5);
1you can use rand() function for that in php.
2Example:
3Generate random numbers between 1 to 50
4<?php
5 echo rand(1,50);
6?>