CakeFest 2024: The Official CakePHP Conference

Reflection::getModifierNames

(PHP 5, PHP 7, PHP 8)

Reflection::getModifierNames修飾子の名前を取得する

説明

public static Reflection::getModifierNames(int $modifiers): array

修飾子の名前を取得します。

パラメータ

modifiers

取得する主食師のビットフィールド

戻り値

修飾子の名前の配列を返します。

例1 Reflection::getModifierNames() の例

<?php
class Testing
{
final public static function
foo()
{
return;
}

public function
bar()
{
return;
}
}

$foo = new ReflectionMethod('Testing', 'foo');

echo
"Modifiers for method foo():\n";
echo
$foo->getModifiers() . "\n";
echo
implode(' ', Reflection::getModifierNames($foo->getModifiers())) . "\n";

$bar = new ReflectionMethod('Testing', 'bar');

echo
"Modifiers for method bar():\n";
echo
$bar->getModifiers() . "\n";
echo
implode(' ', Reflection::getModifierNames($bar->getModifiers()));

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

Modifiers for method foo():
261
final public static
Modifiers for method bar():
65792
public

参考

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top