code to generate 3 digit random number in php code example Example: php randon integer 4 digit $digits = 3; echo rand(pow(10, $digits-1), pow(10, $digits)-1);