Using RegexIterator to filter values of collection

Code
<?php

$i 
= new ArrayIterator(array(1,7,9,null,40,'dude',3));

$filtered = new RegexIterator($i'/\d+/');

foreach(
$filtered as $value) {
    echo 
$value PHP_EOL;
}
Result
1
7
9
40
3
Used Versions
PHP 7.1, Zend 3.0, Symfony 3.2, Laravel 5.2, PHPUnit 5.6, Doctrine 2.6