Re: New RFC : empty() function

From: Date: Mon, 30 Oct 2023 15:21:09 +0000
Subject: Re: New RFC : empty() function
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-121526@lists.php.net to get a copy of this message
> > However, according to my example, the variable is defined and has its > value as 0 or false, and empty() returns true anyway. I confess that > I've had some problems like this, and we chose not to use empty(), as > sometimes 0 or false makes sense as a valid value. > That is exactly as the documentation explains it. empty is to check if a variable is not holding a usable value. 0, false, true are all valid values and show the variable is not empty. The purpose for empty is to check for undefined variables, empty arrays or empty strings. eg. "", [], null or undefined.

« previous php.internals (#121526) next »