What's the difference between isset() and array_key_exists() ?
What's the difference between isset() and array_key_exists() ?
Here is the difference between isset()
and array_key_exists()
in PHP:
isset()
isset()
checks if a variable is set and is not NULL
.isset()
checks if the specified key exists and has a non-NULL
value.NULL
, isset()
will return false
.isset()
can check multiple variables/array keys at once, returning true
only if all of them are set.array_key_exists()
array_key_exists()
checks if the specified key exists in the given array, regardless of its value.true
if the key exists, even if its value is NULL
.array_key_exists()
can only check one array key at a time.In summary:
...
junior
Gợi ý câu hỏi phỏng vấn
Chưa có bình luận nào