Skip to content

Instantly share code, notes, and snippets.

@e0ipso
Created February 16, 2015 12:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save e0ipso/b464751862acf42eef3d to your computer and use it in GitHub Desktop.
Save e0ipso/b464751862acf42eef3d to your computer and use it in GitHub Desktop.
isset & array_key_exists
<?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;
----------------------
⮀ 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