PHPマニュアル/PEARマニュアル | ユーザフォーラムで議論/質問 | マニュアル検索 | ハイライト | ハイライトオフ | ポータル | php spot

ReflectionGenerator::getFunction - Gets the function name of the generator | JavaScript入門&応用&リファレンスなら「JavaScriptist」

  

ReflectionGenerator::getFunction

(PHP 7)

ReflectionGenerator::getFunctionGets the function name of the generator

説明

public ReflectionFunctionAbstract ReflectionGenerator::getFunction ( void )

Enables the function name of the generator to be obtained by returning a class derived from ReflectionFunctionAbstract.

パラメータ

この関数にはパラメータはありません。

返り値

Returns a ReflectionFunctionAbstract class. This will be ReflectionFunction for functions, or ReflectionMethod for methods.

例1 ReflectionGenerator::getFunction() example

<?php

function gen()
{
    
yield 1;
}

$gen gen();

$reflectionGen = new ReflectionGenerator($gen);

var_dump($reflectionGen->getFunction());

上の例の出力は、 たとえば以下のようになります。

object(ReflectionFunction)#3 (1) {
  ["name"]=>
  string(3) "gen"
}

参考


忘却曲線を使ってこの関数を確実に記憶に残す

フォーラムで「ReflectionGenerator::getFunction - Gets the function name of the generator」について話す
各種マニュアル: PHPマニュアル | PEARマニュアル | Smarty(英語)マニュアル | PHP-GTKマニュアル | ReflectionGenerator::getFunction - Gets the function name of the generator」をGoogle検索
copyright © 1997-2024 PHP ドキュメント作成グループ(ライセンス). provided by php spot. マニュアル: