>> I recognize that there is one downside, which is that lazy evaluation >> is lost, but generally don't see it to be an issue in these specific >> cases. >> > Lazy evaluation doesn't have to be lost if the all_of and any_of functions > are written correctly. all_of will return false as soon as one of them fails, > and any_of will return true as soon as one of them passes. > > Unless you are talking about cases like this: > if(is_numeric(reallyFastFunc($foo)) || is_numeric(reallySlowFunc($bar))) > In that case, you might be able to short circuit the evaluation of > reallySlowFunc($bar), which wouldn't be the case with > if(any_of('is_numeric',reallyFastFunc($foo),reallySlowFunc($bar))){}
Yes, this is what I was referring to. As previously stated, I don't think it's likely to be an issue. If it is, then as you stated the normal boolean logic can be used in such places. ----- In other words, nothing needs to be done in PHP itself. Just write or use someone else's `all_of`, `any_of`, `none_of`, etc, functions. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php