gpt4 book ai didi

php - Isset 与 array_key_exists

转载 作者:行者123 更新时间:2023-12-02 23:40:29 26 4
gpt4 key购买 nike

isset在哪里或array_key_exist适合使用吗?

就我而言,两者都有效。

if( isset( $array['index'] ) {
//Do something
}


if( array_key_exists( 'index', $array ) {
//Do something
}

最佳答案

参见:http://us3.php.net/array_key_exists

isset() does not return TRUE for array keys that correspond to a NULL value, while array_key_exists() does.

关于php - Isset 与 array_key_exists,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20116275/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com