Reflection ReflectionMethod::getModifiers
(PHP 5, PHP 7, PHP 8)
ReflectionMethod::getModifiers — 메서드 수정자를 가져옵니다.
설명
public ReflectionMethod::getModifiers(): int
이 메서드에 대한 액세스 한정자의 비트 필드를 반환합니다.
매개변수
이 함수에는 매개변수가 없습니다.
반환 값
수정자의 숫자 표현입니다. 이러한 수정자의 실제 의미는 사전 정의된 상수에 설명되어 있습니다.
Examples
예제 #1 ReflectionMethod::getModifiers() 예제
<?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(): 49 final public static Modifiers for method bar(): 1 public
기타
- Reflection::getModifierNames() - 수정자 이름을 가져옵니다.