欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

php數(shù)組函數(shù)序列之a(chǎn)rray_key_exists() - 查找數(shù)組鍵名是否存在

 更新時間:2011年10月29日 23:03:13   作者:  
array_key_exists() 函數(shù)判斷某個數(shù)組中是否存在指定的 key,如果該 key 存在,則返回 true,否則返回 false
array_key_exists() 定義和用法
array_key_exists() 函數(shù)判斷某個數(shù)組中是否存在指定的 key,如果該 key 存在,則返回 true,否則返回 false。

語法
array_key_exists(key,array)
參數(shù) 描述
key 必需。規(guī)定鍵名。
array 必需。規(guī)定輸入的數(shù)組。

例子 1
復(fù)制代碼 代碼如下:

<?php
$a=array("a"=>"Dog","b"=>"Cat");
if (array_key_exists("a",$a))
{
echo "Key exists!";
}
else
{
echo "Key does not exist!";
}
?>

輸出:

Key exists!
例子 2
復(fù)制代碼 代碼如下:

<?php
$a=array("a"=>"Dog","b"=>"Cat");
if (array_key_exists("c",$a))
{
echo "Key exists!";
}
else
{
echo "Key does not exist!";
}
?>

輸出:

Key does not exist!
例子 2
復(fù)制代碼 代碼如下:

<?php
$a=array("Dog",Cat");
if (array_key_exists(0,$a))
{
echo "Key exists!";
}
else
{
echo "Key does not exist!";
}
?>

輸出:

Key exists!

相關(guān)文章

最新評論