empty("0")

PHP Manual
Prev | Appendix B. Migrating from PHP 3 to PHP 4 | Next

# `empty("0")`

The perhaps most controversial change in behavior has happened to the behavior of the empty(). A String containing only the character '0' (zero) is now considered empty while it wasn't in PHP 3.

This new behavior makes sense in web applications, with all input fields returning strings even if numeric input is requested, and with PHP's capabilities of automatic type conversion. But on the other had it might break your code in a rather subtle way, leading to misbehavior that is hard to track down if you do not know about what to look for.

Prev | Home | Next
Initializers | Up | Missing functions