Skip to content

Instantly share code, notes, and snippets.

@mheap
Created January 30, 2015 12:03
Show Gist options
  • Save mheap/3cb1d3f0d8bc8564af92 to your computer and use it in GitHub Desktop.
Save mheap/3cb1d3f0d8bc8564af92 to your computer and use it in GitHub Desktop.
<?php
// Interestingly, a null value in an isset() check will return false
$r = array(
"a" => 1,
"b" => null
);
echo "a: ".(isset($r['a']) ? 'Yes' : 'No').PHP_EOL;
echo "b: ".(isset($r['b']) ? 'Yes' : 'No').PHP_EOL;
echo "c: ".(isset($r['c']) ? 'Yes' : 'No').PHP_EOL;
/*
* $ php a.php
* a: Yes
* b: No
* c: No
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment