Created
February 16, 2015 12:45
-
-
Save e0ipso/b464751862acf42eef3d to your computer and use it in GitHub Desktop.
isset & array_key_exists
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$array = array( | |
'foo' => 'bar', | |
'baz' => NULL, | |
); | |
print 'isset: ' . (isset($array['baz']) ? 'True' : 'False') . PHP_EOL; | |
print 'array_key_exists: ' . (array_key_exists('baz', $array) ? 'True' : 'False') . PHP_EOL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
---------------------- | |
⮀ php tmp.php | |
isset: False | |
array_key_exists: True | |
---------------------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment