<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >Pseudo-tipos utilizados nesta documentação</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="Tipos" HREF="language.types.html"><LINK REL="PREVIOUS" TITLE="NULL" HREF="language.types.null.html"><LINK REL="NEXT" TITLE="Manipulação de tipos" HREF="language.types.type-juggling.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8"></HEAD ><BODY CLASS="sect1" 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="language.types.null.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" >Capítulo 11. Tipos</TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="language.types.type-juggling.html" ACCESSKEY="N" >Próxima</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="sect1" ><H1 CLASS="sect1" ><A NAME="language.pseudo-types" >Pseudo-tipos utilizados nesta documentação</A ></H1 ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="language.types.mixed" >mixed</A ></H2 ><P > <TT CLASS="literal" >mixed</TT > indica que um parâmetro pode aceitar vários (mas não necessariamente todos) os tipos </P ><P > <A HREF="function.gettype.html" ><B CLASS="function" >gettype()</B ></A >, por exemplo, aceita todos os tipos do PHP, enquanto <A HREF="function.str-replace.html" ><B CLASS="function" >str_replace()</B ></A > somente aceita strings e arrays. </P ></DIV ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="language.types.number" >number</A ></H2 ><P > <TT CLASS="literal" >number</TT > indica que um parâmetro pode ser tanto um <A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A > ou <A HREF="language.types.float.html" ><B CLASS="type" >float</B ></A >. </P ></DIV ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="language.types.callback" >callback</A ></H2 ><P > Some functions like <A HREF="function.call-user-func.html" ><B CLASS="function" >call_user_func()</B ></A > or <A HREF="function.usort.html" ><B CLASS="function" >usort()</B ></A > accept user defined callback functions as a parameter. Callback functions can not only be simple functions but also object methods including static class methods. </P ><P > A PHP function is simply passed by its name as a string. You can pass any builtin or user defined function with the exception of <A HREF="function.array.html" ><B CLASS="function" >array()</B ></A >, <A HREF="function.echo.html" ><B CLASS="function" >echo()</B ></A >, <A HREF="function.empty.html" ><B CLASS="function" >empty()</B ></A >, <A HREF="function.eval.html" ><B CLASS="function" >eval()</B ></A >, <A HREF="function.exit.html" ><B CLASS="function" >exit()</B ></A >, <A HREF="function.isset.html" ><B CLASS="function" >isset()</B ></A >, <A HREF="function.list.html" ><B CLASS="function" >list()</B ></A >, <A HREF="function.print.html" ><B CLASS="function" >print()</B ></A > and <A HREF="function.unset.html" ><B CLASS="function" >unset()</B ></A >. </P ><P > A method of an instantiated object is passed as an array containing an object as the element with index 0 and a method name as the element with index 1. </P ><P > Static class methods can also be passed without instantiating an object of that class by passing the class name instead of an object as the element with index 0. </P ><P > <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN3525" ></A ><P ><B >Exemplo 11-11. Exemplo de funções callback </B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><code><font color="#000000"> <font color="#0000BB"><?php<br /><br /></font><font color="#FF8000">// Exemplo simples de callback<br /></font><font color="#007700">function </font><font color="#0000BB">my_callback_function</font><font color="#007700">() {<br /> echo </font><font color="#DD0000">'Olá Mundo!'</font><font color="#007700">;<br />}<br /></font><font color="#0000BB">call_user_func</font><font color="#007700">(</font><font color="#DD0000">'my_callback_function'</font><font color="#007700">);<br /><br /></font><font color="#FF8000">// Exemplo de metodo callback<br /></font><font color="#007700">class </font><font color="#0000BB">MyClass </font><font color="#007700">{<br /> function </font><font color="#0000BB">myCallbackMethod</font><font color="#007700">() {<br /> echo </font><font color="#DD0000">'Olá Mundo!'</font><font color="#007700">;<br /> }<br />}<br /><br /></font><font color="#FF8000">// Metodo estatico de classe chamado sem qualquer instância do método<br /></font><font color="#0000BB">call_user_func</font><font color="#007700">(array(</font><font color="#DD0000">'MyClass'</font><font color="#007700">, </font><font color="#DD0000">'myCallbackMethod'</font><font color="#007700">));<br /><br /></font><font color="#FF8000">// Chamada de metodo de objeto<br /></font><font color="#0000BB">$obj </font><font color="#007700">= new </font><font color="#0000BB">MyClass</font><font color="#007700">();<br /></font><font color="#0000BB">call_user_func</font><font color="#007700">(array(&</font><font color="#0000BB">$obj</font><font color="#007700">, </font><font color="#DD0000">'myCallbackMethod'</font><font color="#007700">));<br /></font><font color="#0000BB">?></font> </font> </code></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > </P ></DIV ></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="language.types.null.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="language.types.type-juggling.html" ACCESSKEY="N" >Próxima</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >NULL</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="language.types.html" ACCESSKEY="U" >Acima</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Manipulação de tipos</TD ></TR ></TABLE ></DIV ></BODY ></HTML >