On 30.01.2018 at 01:46, Michael Morris wrote:
> So what about this function
>
> bool array_test(array $array [, callable $callback [, mixed $flag = 0]])
>
> Iterates over $array, passing the value of each element to $callback. If
> the callback returns true for all elements the array_test returns true,
> otherwise it returns false. It is not guaranteed to iterate over the entire
> array - it stops when the first false result is returned by the callback.
> Flags are the same as array_filter.
>
> So...
> assert( array_test($a, 'is_string'), TypeError);
> assert( array_test($a, function($v) { return $v instanceof SomeClass; }),
> TypeError);
>
>
> Not what I came into the thread looking for, but it's not bad.
See <https://github.com/php/php-src/pull/1385> which apparently has been
abandoned, unfortunately.
--
Christoph M. Becker
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php