array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'ja', ), 'this' => array ( 0 => 'function.function-exists.php', 1 => 'function_exists', ), 'up' => array ( 0 => 'ref.funchand.php', 1 => '関数処理 関数', ), 'prev' => array ( 0 => 'function.func-num-args.php', 1 => 'func_num_args', ), 'next' => array ( 0 => 'function.get-defined-functions.php', 1 => 'get_defined_functions', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'ja', 'path' => 'reference/funchand/functions/function-exists.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
function
関数名を表す文字列。
function
が存在し、関数である場合に true
、
それ以外の場合に false
を返します。
注意:
この関数は、 include_once や echo のような言語構造については
false
を返します。
例1 function_exists() の例
<?php
if (function_exists('imap_open')) {
echo "IMAP 関数が利用可能です。<br />\n";
} else {
echo "IMAP 関数は利用できません。<br />\n";
}
?>
注意:
ある関数がそれ自体設定やコンパイルオプションの問題で使用できない 場合でもその関数の名前が存在する可能性があることに注意してください (例としては image 関数などがあります)。