This article illustrates the random IP function of PHP implementation. Share to everyone for your reference, specific as follows:
function Get_rand_ip () {
$arr _1 = Array ("218", "218", "66", "66", "218", "218", "60", "60", "202", "204", "66", "66", "66" , "222", "221", "the" "," "", "" "," "," "," "," "," "," "218", "218", "," "," "," "," "," "," "122", "211");
$randarr = Mt_rand (0,count ($arr _1));
$ip 1id = $arr _1[$randarr];
$ip 2id= Round (rand (600000, 2550000) / 10000);
$ip 3id= Round (rand (600000, 2550000) / 10000);
$ip 4id= Round (rand (600000, 2550000) / 10000);
return $ip 1id. "." . $ip 2id. "." . $ip 3id. "." . $ip 4id;
}
Echo get_rand_ip ();//output: 211.104.85.78
More interested in PHP related content readers can view the site topics: "PHP Network Programming Skills Summary", "Php Curl Usage Summary", "PHP Socket Usage Summary", "PHP Regular Expression Usage summary", "PHP string (String) Usage Summary", " PHP array Operation techniques Encyclopedia, "PHP Mathematical Calculation Skills Summary", "PHP object-oriented Programming Introductory Course", "PHP Data structure and algorithm tutorial", "PHP Programming algorithm Summary" and "PHP common database Operation Skills Summary"
I hope this article will help you with the PHP program design.