时间:2021-07-01 10:21:17 帮助过:6人阅读
输出:
$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
";
}
?>
http://www.bkjia.com/PHPjc/324486.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/324486.htmlTechArticlein_array() 定义和用法 in_array() 函数在数组中搜索给定的值。 语法 in_array(value,array,type) 参数 描述 value 必需。规定要在数组搜索的值。 array 必...