1--TEST-- 2Calling generator through magic __call() 3--FILE-- 4<?php 5class A { 6 public function __call($name, $args) { 7 for ($i = 0; $i < 5; $i++) { 8 yield $i; 9 } 10 } 11} 12 13$a = new A(); 14foreach ($a->gen() as $n) { 15 var_dump($n); 16} 17$a->gen(); 18?> 19--EXPECT-- 20int(0) 21int(1) 22int(2) 23int(3) 24int(4) 25