PHP头条
热点:

PHP 顺序查找 PHP,


$i=[5,9,6,12,18,60,62,24];//数组$i

function number($i,$number){

$count=count($i);
for($a=0;$a<$count;$a++){
if($i[$a]==$number){
return $a;
}

}

return false;

}


echo number($i,24);//输出7;
echo '<br>';
var_dump(number($i,24));//输出 int(7);
echo '<br>';
var_dump(number($i,30));//输出 bool(false);

www.phpzy.comtrue/php/25429.htmlTechArticlePHP 顺序查找 PHP, $i=[5,9,6,12,18,60,62,24];//数组$ifunction number($i,$number){$count=count($i);for($a=0;$a$count;$a++){if($i[$a]==$number){return $a;}}return false;}echo number($i,24);//输出7;echo 'br';var_dump(number($i,24));//输...

相关文章

    暂无相关文章

PHP之友评论

今天推荐