PHP is_callable() 함수
예시
변수의 내용을 함수로 호출할 수 있는지 여부를 확인합니다.
<?php
function test1(){
}
echo "test1 is callable: " . is_callable("test1");
echo "<br>";
echo "test2 is callable: " . is_callable("test2");
?>
정의 및 사용
is_callable() 함수는 변수의 내용을 함수로 호출할 수 있는지 여부를 확인합니다.
이 함수는 변수가 호출 가능한 경우 true(1)를 반환하고, 그렇지 않으면 false/no를 반환합니다.
통사론
is_callable(variable, syntax_only, name );
매개변수 값
Parameter | Description |
---|---|
variable | Required. Specifies the variable to check |
syntax_only | Optional. If set to TRUE, the function only verifies if variable is a function or method. It will reject variables that are not strings, or arrays without a valid structure to be used as a callback. Default is false |
name | Optional. Returns a "callable name" (only for classes) |
기술적 세부 사항
반환 값: | 변수 가 호출 가능 하면 TRUE , 그렇지 않으면 FALSE |
---|---|
반환 유형: | 부울 |
PHP 버전: | 4.0.6+ |
❮ PHP 변수 처리 참조