- var_dump: documentation ( source)
- microtime: documentation ( source)
- range: documentation ( source)
<?php
$a = range(0, 250_000);
$b = range(250_000, 500_000);
$gen = function(array ...$input):iterable{foreach($input as $it) {yield from $it;}};
$start = microtime(true);
foreach($gen($a, $b) as $key => $item){
//
}
$elapsed = microtime(true) - $start;
var_dump($elapsed);