设为首页 加入收藏

TOP

php中的常用数组函数(四)(数组中是否有某个键名或索引)
2017-10-10 12:00:52 】 浏览:6829
Tags:php 常用 函数 是否 某个 索引
/***********array_key_exists(检查键名或索引是否在数组中)*****************/
$arr1 = array('name' => 'Sheldon', 'age' => 30, 'address' => 'Carlifornia');
if (array_key_exists('name', $arr1)) {
    echo 'the name element is in the array.';
} else {
    echo 'name elment not exist.';
}

查看$arr1中有没有叫'name'的键名。

也可以检查 数字索引。

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇php中的常用数组函数(二)(数组.. 下一篇php中的常用数组函数(五)(数组..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目