Whenever I try to access a property of an array that does not exist, php throws an ERROR_NOTICE that reads like this:
Notice: Undefined offset: BLANK in BLANK on line BLANK
$a = array("a","b","c");
$a[4]; //throws an error
Instead, if I use isset to test for the existence of this property, this error is not thrown.
$a = array("a","b","c");
isset($a[4]); //does not throw an error
Since php does evaluate arguments before passing them to a function, how does isset avoid to throw an error?
isset isn't a function but a language construct:
Note: Because this is a language construct and not a function, it cannot be called using variable functions.
It's not called the way functions are called but handled specially by the language. The same goes for empty.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With