时间:2021-07-01 10:21:17 帮助过:9人阅读
代码如下:
$people = array("Peter", "Joe", "Glenn", "Cleveland");
if (in_array("Glenn",$people))
{
echo "Match found";
}
else
{
echo "Match not found";
}
?>
代码如下:
$people = array("Peter", "Joe", "Glenn", "Cleveland", 23);
if (in_array("23",$people, TRUE))
{
echo "Match found
";
}
else
{
echo "Match not found
";
}if (in_array("Glenn",$people, TRUE))
{
echo "Match found
";
}
else
{
echo "Match not found
";
}if (in_array(23,$people, TRUE))
{
echo "Match found
";
}
else
{
echo "Match not found
";
}
?>
以上就介绍了 php数组函数序列之in_array - 查找数组中是否存在指定值,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。