Ask an idiot question
 蒹葭苍苍
 蒹葭苍苍 2017-09-13 14:15:44
0
1
965

The random function rand() generates ten random integers between (-10,10) and saves them in the arr1 array. Query whether there is a random integer 0 among the ten random integers generated in array arr1. If yes, output "the ten random integers generated this time contain the random number 0" in the web page; if not, output in the web page "the ten random integers generated this time do not contain the random number 0".

 蒹葭苍苍
 蒹葭苍苍

reply all(1)
super|鹏

<?php

$arr = array();

for ($i=0; $i < 10; $i++) {

$arr[$i] = rand(-10,10);

}

echo "<pre>";

var_dump($arr);

foreach ($arr as $k => $v) {

if($v == 0){

echo 'The ten random integers generated this time contain the random number 0';

die;

}

}

echo 'The ten random integers generated this time do not contain the random number 0';


Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template