Reflection Reflection::getModifierNames
(PHP 5, PHP 7, PHP 8)
Reflection::getModifierNames — 수정자 이름을 가져옵니다.
설명
public static Reflection::getModifierNames(int $modifiers
): array
수정자 이름을 가져옵니다.
매개변수
modifiers
- 가져올 수정자의 비트 필드입니다.
반환 값
수정자 이름의 배열입니다.
Examples
예제 #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
기타
- ReflectionClass::getModifiers() - 클래스 수정자를 가져옵니다.
- ReflectionClassConstant::getModifiers() - 클래스 상수 수정자를 가져옵니다.
- ReflectionMethod::getModifiers() - 메서드 수정자를 가져옵니다.
- ReflectionProperty::getModifiers() - 속성 수정자를 가져옵니다.