时间:2021-07-01 10:21:17 帮助过:3人阅读
输出:
<?php
$people = array("Peter", "Joe", "Glenn", "Cleveland");
if (in_array("Glenn",$people))
{
echo "Match found";
}
else
{
echo "Match not found";
}
?>
输出:
<?php
$people = array("Peter", "Joe", "Glenn", "Cleveland", 23);
if (in_array("23",$people, TRUE))
{
echo "Match found<br />";
}
else
{
echo "Match not found<br />";
}if (in_array("Glenn",$people, TRUE))
{
echo "Match found<br />";
}
else
{
echo "Match not found<br />";
}if (in_array(23,$people, TRUE))
{
echo "Match found<br />";
}
else
{
echo "Match not found<br />";
}
?>