bool array_key_exists ( $key, $array );
如果在数组中设置了给定的键,则返回true。
Sr.No | Parameter & Description |
---|---|
1 |
key(必需) 链接:https://www.learnfk.comhttps://www.learnfk.com/php/php-function-array-key-exists.html 来源:LearnFk无涯教程网 要搜索的关键字。 |
2 |
array(必需) 这是要搜索的数组 |
如果给定键在数组中设置,则返回TRUE,否则返回FALSE。
<?php $input=array('first' => 10, 'second' => 400); if (array_key_exists('first', $input)) { echo "The 'first' element is in the array"; } ?>
这将产生以下输出-
The 'first' element is in the array
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)