« PHP 8.3 Manual トップ
著作権 »
per page, with , order by , clip by
Results of 1 - 1 of about 1 for printer (0.001 sec.)
Generator::send — 値をジェネレータに送る | PHP 8.3 9414
Generator::send (PHP 5 >= 5.5.0, PHP 7, PHP 8) Generator::send — 値をジェネレータに送る 説明 public function Generator::send ( mixed $value ): mixed 指定した値を yield の結果としてジェネレータに送り、ジェネレータを続行します。 ジェネレータが ... している yield 式の戻り値になります。 戻り値 yield した値を返します。 例 例1 Generator::send() による値の注入 <?php function printer () { echo "I'm printer!" . PHP_EOL ; while ( true ) { $string = yield; echo $string . PHP_EOL ; } } $printer = printer (); ... $printer -> send ( 'Hello world!' ); $printer -> send ( 'Bye world!' ); ?> 上の例の出力は以下となります。 I'm printer! Hello world! ...
https://man.mtool.work/php/8.3/generator.send.html
PREV 1 NEXT