I have this program:
if (!isset($_POST['foo'])) doSomeThing1();
else {
if (!array_key_exists('foo',$_POST)) doSomeThing2();
else doSomeThing3();
}
but... the program flow goes to the 3d case, failing with the error: undefined index 'foo' (in file.php, line xxx)
.
Could you explain, why?
Why array_key_exists
returns true
(which brings the script to the 3d case) but subsequently it is "undefined index"?