On Wednesday, September 18, 2013 at 12:53 PM, Leigh wrote: > Hi Internals. > > How do you feel about expanding the is_* functions to accept multiple > parameters similar to the way isset() already does? > > From the manual: "If multiple parameters are supplied then isset() will > return TRUE only if all of the parameters are set. Evaluation goes from > left to right and stops as soon as an unset variable is encountered." > > I am proposing that all of the is_* functions are allowed to take a > variable number of parameters and will return true if all of the arguments > satisfy what is being checked. > > i.e. is_null($a, $b, $c) would be the same as is_null($a) && is_null($b) > && is_null($c) > > As well as producing much more succinct code and less function call > overhead, I think this ties in nicely with the variadic and unpacking RFCs > and is especially useful for parameters that cannot be typehinted; for > example you would be able to something like: > > function doStuffWithNumbers(...$numbers) { > if (!is_int(...$numbers)) { > throw new InvalidArgumentException('blah'); > ... > > Thoughts? are_int()
kindly, nvartolomei =) -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php