Hacker Timesnew | past | comments | ask | show | jobs | submitlogin



I could see it being depreciated for use on non-arrays, but at the moment the only other method of detecting an empty array is `!count($arr)`, which is significantly slower if the array isn't empty.

Ultimately this isn't a language issue, it's a training issue. If you're using empty in place of isset, you're doing it wrong, the both serve completely different purposes.


Empty is identical to the not operator (!) except it also works on undefined variables, properties, and keys.


What you mean "unreliable"? It is completely reliable and described in the documentation. It doesn't fit some use cases, in these cases you could use other facilities provided by the language, PHP can not have separate language construct for every use case.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: