DEV Community

Discussion on: Using isset() and empty() hurts your code

Collapse
 
davidnash profile image
David Nash

I've been using PHP for around 15 years. I've never really liked isset() and empty(), mainly because of their names. empty() should be isempty().

Then there are functions like is_int() which use another name style. (I'd prefer they were all named like this).

I STILL have to look up those function names every time. Now I'm not going to bother :-)

And I didn't know about array_key_exists()... Thanks!

Collapse
 
jsn1nj4 profile image
Elliot Derhay

Yeah the mixed naming conventions were starting to annoy me too recently. Haven't been using the language nearly as long as you have. But I would hope they would do something like rename all of the runonname functions the other way, alias the old names to the new ones, and then include a deprecation message for the old names and move on. At least that way it would be backwards compatible for however long before they're removed entirely.

Would also prefer renaming some functions like strlen to string_length or at least str_length.

Collapse
 
moopet profile image
Ben Sinclair

I've been using PHP since version 3 and still have to look up the order of needles and haystacks, or the order in array_map vs array_filter every time.