runkit7_function_add
(PECL runkit7 >= Unknown)
runkit7_function_add — create_function()과 유사한 새 함수 추가
설명
runkit7_function_add( string $function_name, string $argument_list, string $code, bool $return_by_reference = null, string $doc_comment = null, string $return_type = ?, bool $is_strict = ? ): bool
runkit7_function_add( string $function_name, Closure $closure, string $doc_comment = null, string $return_type = ?, bool $is_strict = ? ): bool
매개변수
function_name
- 생성할 함수의 이름
argument_list
- 쉼표로 구분된 인수 목록
code
- 함수를 구성하는 코드
closure
- 함수를 정의하는 클로저.
return_by_reference
- 함수가 참조로 반환해야 하는지 여부입니다.
doc_comment
- 함수의 문서 주석입니다.
return_type
- 함수의 반환 유형입니다.
is_strict
- 함수가 strict_types=1인 파일에서 선언된 것처럼 동작해야 하는지 여부
반환 값
성공하면 true
를, 실패하면 false
를 반환합니다.
Examples
예제 #1 runkit7_function_add() 예제
<?php
runkit7_function_add('testme','$a,$b','echo "The value of a is $a\n"; echo "The value of b is $b\n";');
testme(1,2);
?>
위의 예는 다음을 출력합니다.
The value of a is 1 The value of b is 2
기타
- create_function() - 익명(람다 스타일) 함수 만들기
- runkit7_function_redefine() - 함수 정의를 새 구현으로 교체
- runkit7_function_copy() - 함수를 새 함수 이름으로 복사
- runkit7_function_rename() - 함수 이름 변경
- runkit7_function_remove() - 함수 정의 제거
- runkit7_method_add() - 주어진 클래스에 새로운 메소드를 동적으로 추가