Zend certified PHP/Magento developer

How to check for existence of boolean value of ‘false’ in array? isset() says the value is not there because it is ‘false’. Is there a more precise version of isset()?

Had an issue at work where I needed to check if a variable in the $_SESSION array existed. At first I would set the value of the variable to simple boolean values of true or false. However, when the value was false, isset() assumed that the value did not exist at all. In the end I changed the booleans to string representations (i.e. “true” and “false”) and that worked but it feels dirty.

Coming from a JS background I’d like to know if there is another function similar to isset() or PHP way of doing things with isset() where it does not assume a variable isn’t set at all when the variable is set as the boolean value of ‘false’. Thanks /r/php.

EDIT: Seems like I need to figure it out more, consider this question closed.

submitted by /u/poopduck5
[link] [comments]