Reflection ReflectionFunction::invoke
(PHP 5, PHP 7, PHP 8)
ReflectionFunction::invoke — 함수 호출
설명
public ReflectionFunction::invoke(mixed ...$args
): mixed
반영된 함수를 호출합니다.
매개변수
args
- 전달된 인수 목록입니다. call_user_func()와 마찬가지로 함수에 전달되는 가변 수의 인수를 허용합니다.
반환 값
호출된 함수 호출의 결과를 반환합니다.
Examples
예제 #1 ReflectionFunction::invoke() 예제
<?php
function title($title, $name)
{
return sprintf("%s. %s\r\n", $title, $name);
}
$function = new ReflectionFunction('title');
echo $function->invoke('Dr', 'Phil');
?>
위의 예는 다음을 출력합니다.
Dr. Phil
메모
메모: 참조 매개변수가 필요한 경우 ReflectionFunction::invoke()
를 사용할 수 없습니다. ReflectionFunction::invokeArgs()를 대신 사용해야 합니다(인수 목록의 참조 전달).
기타
- ReflectionFunction::export() - Exports function
- __invoke()
- call_user_func() - 첫 번째 매개변수에 의해 제공된 콜백 호출