Hello Everyone today I guide you "What is the difference between isset and array_key_exists in PHP"
The below example helps you to differentiate between isset() and array_key_exists() .
isset() will only return true or false
array_key_exists() will return the key and its value
<?php
$newdata = array('key1' => 'Hello, 'key2' => null);
isset($newdata['key1']); // true
array_key_exists('key1', $newdata); // true
isset($newdata['key2']); // false
array_key_exists('key2', $newdata); // true
?>
0 Comment(s)