본문으로 바로가기

[PHP] function_exists

category Helloworld!/PHP 2013. 7. 5. 18:34
function_exists

bool function_exists (string $function_name) : 함수가 존재하는지 존재 하지 않는지 체크 하는 함수
bool값을 리턴으로 한다. 함수가 존재하면 return true 존재하지 않는 다면 return false를 반환
function output($string) {
    echo $string;
}

if( function_exists(output) ) {
    $string = "Test....";
    output($string);
} else {
    echo "error!";
}