fork download
  1. <?php
  2.  
  3. var_dump(isset($array['a'])); // bool(false)
  4. var_dump(array_key_exists('a', $array)); // lança um "PHP Notice: Undefined variable" e imprime "NULL"
  5.  
  6. $array = ['a' => null, 'b' => 2];
  7.  
  8. var_dump(isset($array['a'])); // bool(false)
  9. var_dump(array_key_exists('a', $array)); // bool(true)
  10.  
  11. var_dump(isset($array['b'])); // bool(true)
  12. var_dump(array_key_exists('b', $array)); // bool(true)
Success #stdin #stdout #stderr 0.02s 52432KB
stdin
Standard input is empty
stdout
bool(false)
NULL
bool(false)
bool(true)
bool(true)
bool(true)
stderr
PHP Notice:  Undefined variable: array in /home/MCw0SU/prog.php on line 4
PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in /home/MCw0SU/prog.php on line 4