> function doStuffWithNumbers(...$numbers) { > if (!is_int(...$numbers)) { > throw new InvalidArgumentException('blah'); > ... > > Thoughts?
Returning bool in this case will make it impossible to respond with a meaningful error message. Which of the provided arguments !is_int()? Instead, I would go with f.Ex.: $numbers = array(...$numbers); $result = array_filter($numbers, "is_int") and compare the arrays. Since the array keys are preserved, it's easy to find out, which argument !is_int(). Finally, the imho best solution would still be introducing optional scalar type hinting. But that is another topic and shouldn't be discussed here. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php