<HTML ><HEAD ><TITLE >function_exists</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="PHP Manual" HREF="index.html"><LINK REL="UP" TITLE="Function Handling functions" HREF="ref.funchand.html"><LINK REL="PREVIOUS" TITLE="func_num_args" HREF="function.func-num-args.html"><LINK REL="NEXT" TITLE="get_defined_functions" HREF="function.get-defined-functions.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-1"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP Manual</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.func-num-args.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.get-defined-functions.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.function-exists" ></A >function_exists</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN29321" ></A ><P > (PHP 3>= 3.0.7, PHP 4 )</P >function_exists -- Return <TT CLASS="constant" ><B >TRUE</B ></TT > if the given function has been defined </DIV ><DIV CLASS="refsect1" ><A NAME="AEN29325" ></A ><H2 >Description</H2 >bool <B CLASS="methodname" >function_exists</B > ( string function_name)<BR ></BR ><P > Checks the list of defined functions, both built-in (internal) and user-defined, for <TT CLASS="parameter" ><I >function_name</I ></TT >. Returns <TT CLASS="constant" ><B >TRUE</B ></TT > on success or <TT CLASS="constant" ><B >FALSE</B ></TT > on failure. <DIV CLASS="informalexample" ><A NAME="AEN29337" ></A ><P ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="php" >if (function_exists('imap_open')) { echo "IMAP functions are available.<br>\n"; } else { echo "IMAP functions are not available.<br>\n"; }</PRE ></TD ></TR ></TABLE ><P ></P ></DIV > Note that a function name may exist even if the function itself is unusable due to configuration or compiling options (with the <A HREF="ref.image.html" >image</A > functions being an example). Also note that <B CLASS="function" >function_exists()</B > will return <TT CLASS="constant" ><B >FALSE</B ></TT > for constructs, such as <A HREF="function.include-once.html" ><B CLASS="function" >include_once()</B ></A > and <A HREF="function.echo.html" ><B CLASS="function" >echo()</B ></A >. </P ><P > See also <A HREF="function.method-exists.html" ><B CLASS="function" >method_exists()</B ></A > and <A HREF="function.get-defined-functions.html" ><B CLASS="function" >get_defined_functions()</B ></A >. </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.func-num-args.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.get-defined-functions.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >func_num_args</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.funchand.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >get_defined_functions</TD ></TR ></TABLE ></DIV ></BODY ></HTML >