3v4l.org

run code in 300+ PHP versions simultaneously
<?php function yieldMe() : iterable { yield 1; yield 2; yield 3; } function someFunction(bool $toArray=true) : iterable { $found = yieldMe(); if($toArray){ return iterator_to_array($found); } yield from $found; } $result = someFunction(); foreach($result as $r){ echo $r."\n"; }

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
202.18 ms | 1981 KiB | 13 Q