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
                

기타