<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >function_exists</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="Manual do PHP" HREF="index.html"><LINK REL="UP" TITLE="Funções para manuseamento de funções" 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=UTF-8"></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" >Manual do PHP</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.func-num-args.html" ACCESSKEY="P" >Anterior</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" >Próxima</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="AEN59144" ></A ><P > (PHP 3 >= 3.0.7, PHP 4, PHP 5)</P >function_exists -- Retorna <TT CLASS="constant" ><B >TRUE</B ></TT > se a função dada está definida </DIV ><DIV CLASS="refsect1" ><A NAME="AEN59148" ></A ><H2 >Descrição</H2 >bool <B CLASS="methodname" >function_exists</B > ( string function_name )<BR ></BR ><P > Verifica a lista de funções definidas, ambas embutidas (interna) e definidas pelo usuário, para <CODE CLASS="parameter" >function_name</CODE >. Retorna <TT CLASS="constant" ><B >TRUE</B ></TT > em caso de sucesso ou <TT CLASS="constant" ><B >FALSE</B ></TT > em falhas. </P ><P > <DIV CLASS="informalexample" ><P ></P ><A NAME="AEN59161" ></A ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><code><font color="#000000"> <font color="#0000BB"><?php<br /></font><font color="#007700">if (</font><font color="#0000BB">function_exists</font><font color="#007700">(</font><font color="#DD0000">'imap_open'</font><font color="#007700">)) {<br /> echo </font><font color="#DD0000">"IMAP functions are available.<br />\n"</font><font color="#007700">;<br />} else {<br /> echo </font><font color="#DD0000">"IMAP functions are not available.<br />\n"</font><font color="#007700">;<br />}<br /></font><font color="#0000BB">?></font> </font> </code></TD ></TR ></TABLE ><P ></P ></DIV > </P ><P > Note que o nome da função deve existir se a função chama a si própria se torna inútil devido a configuração ou opções de compilação (com a função <A HREF="ref.image.html" >image</A > sendo um exemplo). Note também que <B CLASS="function" >function_exists()</B > irá retornar <TT CLASS="constant" ><B >FALSE</B ></TT > para construtores, como <A HREF="function.include-once.html" ><B CLASS="function" >include_once()</B ></A > e <A HREF="function.echo.html" ><B CLASS="function" >echo()</B ></A >. </P ><P > Veja também <A HREF="function.method-exists.html" ><B CLASS="function" >method_exists()</B ></A > e <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" >Anterior</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Principal</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.get-defined-functions.html" ACCESSKEY="N" >Próxima</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" >Acima</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >get_defined_functions</TD ></TR ></TABLE ></DIV ></BODY ></HTML >