4 ms·
So isset and empty don't actually check what their name suggests. I think the problem is finding a short name for a little complex functionality
by croes 2y ago
So isset and empty don't actually check what their name suggests.
I think the problem is finding a short name for a little complex functionality
- joshstrange 2y agoIf you want to find sane function naming, PHP is only going to disappoint you. I say that as someone who likes PHP, the old function names (and argument order) are… not great. isset is like is_null but one thing isset can do is look at a whole chain (class props or associate array keys) and not blow up. What I mean by that is you can do $test = null; isset($test->fake[‘doesNotExist’]->stilFake); // false Whereas is_null would throw an error trying to walk a fake path. “isset” does essentially a try/catch-type thing around the check it’s doing.