<?php var_dump(isset($array['a'])); // bool(false)var_dump(array_key_exists('a', $array)); // lança um "PHP Notice: Undefined variable" e imprime "NULL" $array = ['a' => null, 'b' => 2]; var_dump(isset($array['a'])); // bool(false)var_dump(array_key_exists('a', $array)); // bool(true) var_dump(isset($array['b'])); // bool(true)var_dump(array_key_exists('b', $array)); // bool(true)
Standard input is empty
bool(false) NULL bool(false) bool(true) bool(true) bool(true)
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
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!