Sophie

Sophie

distrib > Mandriva > 2008.1 > i586 > by-pkgid > 703d980c580707c382b4e43e25965bc5 > files > 10851

php-manual-pt_BR-5.2.4-1mdv2008.1.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>Erros e Logs</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="Referência das Funções"
HREF="funcref.html"><LINK
REL="PREVIOUS"
TITLE="enchant_dict_suggest"
HREF="function.enchant-dict-suggest.html"><LINK
REL="NEXT"
TITLE="debug_backtrace"
HREF="function.debug-backtrace.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=UTF-8"></HEAD
><BODY
CLASS="reference"
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.enchant-dict-suggest.html"
ACCESSKEY="P"
>Anterior</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.debug-backtrace.html"
ACCESSKEY="N"
>Próxima</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="reference"
><A
NAME="ref.errorfunc"
></A
><DIV
CLASS="TITLEPAGE"
><H1
CLASS="title"
>XXXIII. Erros e Logs</H1
><DIV
CLASS="PARTINTRO"
><A
NAME="AEN43569"
></A
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="errorfunc.intro"
>Introdução</A
></H1
><P
>&#13;    Estas são funções para lidar com erros e logs.
    Elas permitem a você definir a suas próprias regras para manusear
    erros, assim como para modificar a maneira com que é efetuado o log de erros.
    Isto permite a você melhorar e adaptar as suas necessidades os avisos de erro.
   </P
><P
>&#13;    Com as funções de log, você pode mandar mensagens diretamente para outras máquinas,
    para um email (ou email para um pager), para os logs do sistema, etc,
    assim você pode seletivamente logar e monitorar as partes mais importantes
    das suas aplicações e websites.
   </P
><P
>&#13;    As funções de erro permitem você configurar quais níveis de erro devem ser reportados
    e o tipo de resposta que será dado, indo desde simples avisos até as funções retornadas
    durante os erros.
   </P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="errorfunc.requirements"
>Dependências</A
></H1
><P
>Nenhuma biblioteca externa é necessária para compilar esta extensão.</P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="errorfunc.installation"
>Instalação</A
></H1
><P
>Não há nenhuma instalação necessária para utilizar estas
 funções, elas fazem parte do núcleo do PHP.</P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="errorfunc.configuration"
>Configurações em execução</A
></H1
><P
>&#13;O comportamento dessas funções podem ser modificado pelas configurações do <TT
CLASS="filename"
>php.ini</TT
>.
</P
><P
>&#13;  <DIV
CLASS="table"
><A
NAME="AEN43586"
></A
><P
><B
>Tabela 1. Opções de configurações de erros e log</B
></P
><TABLE
BORDER="1"
CLASS="CALSTABLE"
><COL><COL><COL><THEAD
><TR
><TH
>Nome</TH
><TH
>Padrão</TH
><TH
>Modificável</TH
></TR
></THEAD
><TBODY
><TR
><TD
>error_reporting</TD
><TD
>E_ALL &#38; ~E_NOTICE</TD
><TD
>PHP_INI_ALL</TD
></TR
><TR
><TD
>display_errors</TD
><TD
>"1"</TD
><TD
>PHP_INI_ALL</TD
></TR
><TR
><TD
>display_startup_errors</TD
><TD
>"0"</TD
><TD
>PHP_INI_ALL</TD
></TR
><TR
><TD
>log_errors</TD
><TD
>"0"</TD
><TD
>PHP_INI_ALL</TD
></TR
><TR
><TD
>log_errors_max_len</TD
><TD
>"1024"</TD
><TD
>PHP_INI_ALL</TD
></TR
><TR
><TD
>ignore_repeated_errors</TD
><TD
>"0"</TD
><TD
>PHP_INI_ALL</TD
></TR
><TR
><TD
>ignore_repeated_source</TD
><TD
>"0"</TD
><TD
>PHP_INI_ALL</TD
></TR
><TR
><TD
>report_memleaks</TD
><TD
>"1"</TD
><TD
>PHP_INI_ALL</TD
></TR
><TR
><TD
>track_errors</TD
><TD
>"0"</TD
><TD
>PHP_INI_ALL</TD
></TR
><TR
><TD
>html_errors</TD
><TD
>"1"</TD
><TD
>PHP_INI_ALL</TD
></TR
><TR
><TD
>docref_root</TD
><TD
>""</TD
><TD
>PHP_INI_ALL</TD
></TR
><TR
><TD
>docref_ext</TD
><TD
>""</TD
><TD
>PHP_INI_ALL</TD
></TR
><TR
><TD
>error_prepend_string</TD
><TD
>NULL</TD
><TD
>PHP_INI_ALL</TD
></TR
><TR
><TD
>error_append_string</TD
><TD
>NULL</TD
><TD
>PHP_INI_ALL</TD
></TR
><TR
><TD
>error_log</TD
><TD
>NULL</TD
><TD
>PHP_INI_ALL</TD
></TR
><TR
><TD
>warn_plus_overloading</TD
><TD
>NULL</TD
><TD
>PHP_INI??</TD
></TR
></TBODY
></TABLE
></DIV
>
  Para maiores detalhes e definição das constantes do PHP_INI_* veja
  <A
HREF="function.ini-set.html"
><B
CLASS="function"
>ini_set()</B
></A
>.
 </P
><P
>Breve descrição das
 diretivas de configuração.</P
><P
>&#13;  <P
></P
><DIV
CLASS="variablelist"
><DL
><DT
><A
NAME="ini.error-reporting"
></A
><CODE
CLASS="parameter"
>error_reporting</CODE
>
     <A
HREF="language.types.integer.html"
><B
CLASS="type"
>integer</B
></A
></DT
><DD
><P
>&#13;      Define o nível de erros para reportar. O parâmetro pode ser um inteiro
      ou uma constante. Os níveis de erros para reportar estão descritos em
      <A
HREF="ref.errorfunc.html#errorfunc.constants"
>Constantes Predefinidas</A
>,
      e no <TT
CLASS="filename"
>php.ini</TT
>. Para definir em tempo de execução, use a função
      <A
HREF="function.error-reporting.html"
><B
CLASS="function"
>error_reporting()</B
></A
>. Veja também a diretiva
      <A
HREF="ref.errorfunc.html#ini.display-errors"
>display_errors</A
>.
     </P
><P
>&#13;      No PHP 4 e PHP 5 o valor padrão é E_ALL &#38; ~E_NOTICE. Esta
      definição não mostra erros de nível <TT
CLASS="constant"
><B
>E_NOTICE</B
></TT
>. Você
      deve querer mostra-los durante o desenvolvimento.
     </P
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Nota: </B
>
       Ativando <TT
CLASS="constant"
><B
>E_NOTICE</B
></TT
> durante o desenvolvimento tem alguns beneficios. 
       Para o proposito de eliminar erros: mensagens NOTICE irão avisar você
       sobre possiveis erros em seu código. Por exemplo, o uso de valores não definidos
       é avisado. É extremamente útil para encontrar erros de digitação e economisar
       tempo na correção de erros. As mensagens NOTICE irão avisar a você sobre mal estilo.
       Por exemplo, $arr[item] é melhor que seja escrito como $arr['item'] já que o PHP irá
       tratar "item" como uma constante. Se não for uma constante, o PHP irá considerar 
       como uma string de índice para a matriz.
      </P
></BLOCKQUOTE
></DIV
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Nota: </B
>
       No PHP 5 um novo nível de erro <TT
CLASS="constant"
><B
>E_STRICT</B
></TT
> esta disponível.
       Já que <TT
CLASS="constant"
><B
>E_STRICT</B
></TT
> não esta incluída em
       <TT
CLASS="constant"
><B
>E_ALL</B
></TT
> você deve explicitamente ativar este nível de erro.
       Ativar <TT
CLASS="constant"
><B
>E_STRICT</B
></TT
> durante o desenvolvimento tem alguns beneficios.
       Mensagem STRICT irão ajudar a você a utilizar o metodo
       mais recente de codificação, por exemplo, avisar você sobre funções obsoletas.
      </P
></BLOCKQUOTE
></DIV
><P
>&#13;      No PHP 3, a definição padrão é
      <TT
CLASS="literal"
>(E_ERROR | E_WARNING | E_PARSE)</TT
>,
      indicando a mesma coisa. Note, entretanto, desde que constantes não são
      suportadas no <TT
CLASS="filename"
>php3.ini</TT
> do PHP 3, a definição do nível
      de erros para reportar deve ser númerica, neste caso <TT
CLASS="literal"
>7</TT
>.
     </P
></DD
><DT
><A
NAME="ini.display-errors"
></A
><CODE
CLASS="parameter"
>display_errors</CODE
>
     <A
HREF="language.types.boolean.html"
><B
CLASS="type"
>boolean</B
></A
></DT
><DD
><P
>&#13;      Isto determina quando os erros devem ser mostrados
      como parte da saída ou se devem ser escondidos do usuário.
     </P
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Nota: </B
>
      Isto serve para suportar o seu desenvolvimento e nunca deve
      ser usado em sistemas de produção (ex. sistemas conectados a internet).
      </P
></BLOCKQUOTE
></DIV
></DD
><DT
><A
NAME="ini.display-startup-errors"
></A
><CODE
CLASS="parameter"
>display_startup_errors</CODE
>
     <A
HREF="language.types.boolean.html"
><B
CLASS="type"
>boolean</B
></A
></DT
><DD
><P
>&#13;      Mesmo quando display_errors esta em on, erros que aconteçam durante a inicialização
      do PHP não são mostrados. É fortemente recomendado manter
      display_startup_errors em off, exceto para procurar erros.
     </P
></DD
><DT
><A
NAME="ini.log-errors"
></A
><CODE
CLASS="parameter"
>log_errors</CODE
>
     <A
HREF="language.types.boolean.html"
><B
CLASS="type"
>boolean</B
></A
></DT
><DD
><P
>&#13;      Indica se as mensagens de erro do script devem ficar no log
      de erros do servidor ou em <A
HREF="ref.errorfunc.html#ini.error-log"
>error_log</A
>.
      Esta opção depende do servidor.
     </P
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Nota: </B
>
       Você é fortemente avisado para usar o log de erros ao
       invés de mostra-los em web sites de produção.
      </P
></BLOCKQUOTE
></DIV
></DD
><DT
><A
NAME="ini.log-errors-max-len"
></A
><CODE
CLASS="parameter"
>log_errors_max_len</CODE
>
     <A
HREF="language.types.integer.html"
><B
CLASS="type"
>integer</B
></A
></DT
><DD
><P
>&#13;      Define o limite de tamanho da mensagem de erro para logar em bytes. Em
      <A
HREF="ref.errorfunc.html#ini.error-log"
>error_log</A
> é adicionada informação
      sobre a fonte. O padrão é 1024 e 0 permite que não seja
      estabelecido nenhum limite.
     </P
></DD
><DT
><A
NAME="ini.ignore-repeated-errors"
></A
><CODE
CLASS="parameter"
>ignore_repeated_errors</CODE
>
     <A
HREF="language.types.boolean.html"
><B
CLASS="type"
>boolean</B
></A
></DT
><DD
><P
>&#13;      Não loga mensagens repetidas. Erros repetidos devem acontecer no mesmo
      arquivo na mesma linha enquanto
      <A
HREF="ref.errorfunc.html#ini.ignore-repeated-source"
>ignore_repeated_source</A
>
      estiver em true.
     </P
></DD
><DT
><A
NAME="ini.ignore-repeated-source"
></A
><CODE
CLASS="parameter"
>ignore_repeated_source</CODE
>
     <A
HREF="language.types.boolean.html"
><B
CLASS="type"
>boolean</B
></A
></DT
><DD
><P
>&#13;      Ignora a fonte da mensagem quando estiver ignorando mensagens repetidos.
      Quando esta definição ON não irá logar mensagens de erros repetidas de
      arquivos diferentes ou linhas diferentes.
     </P
></DD
><DT
><A
NAME="ini.report-memleaks"
></A
><CODE
CLASS="parameter"
>report_memleaks</CODE
>
     <A
HREF="language.types.boolean.html"
><B
CLASS="type"
>boolean</B
></A
></DT
><DD
><P
>&#13;      Se este parâmetro estiver em Off, quando acontecerem memory leaks não será mostrado (na
      saída ou no log). Isto só tem efeito numa compilação de debug, e se
      <A
HREF="ref.errorfunc.html#ini.error-reporting"
>error_reporting</A
> incluir
      E_WARNING na lista de permitidos.
     </P
></DD
><DT
><A
NAME="ini.track-errors"
></A
><CODE
CLASS="parameter"
>track_errors</CODE
>
     <A
HREF="language.types.boolean.html"
><B
CLASS="type"
>boolean</B
></A
></DT
><DD
><P
>&#13;      Se ativado, a última mensagem de erro sempre estará disponível na
      variável <A
HREF="reserved.variables.html#reserved.variables.phperrormsg"
>$php_errormsg</A
>.
     </P
></DD
><DT
><A
NAME="ini.html-errors"
></A
><CODE
CLASS="parameter"
>html_errors</CODE
>
     <A
HREF="language.types.boolean.html"
><B
CLASS="type"
>boolean</B
></A
></DT
><DD
><P
>&#13;      Desativa as tags HTML nas mensagens de erro. O novo formato de mensagens de erro em HTML
      produz mensagens que podem ser clicadas e que direcionam o usuário para uma pagina descrevendo
      o erro ou a função que causou o erro. Estas referencias são afetadas por
      <A
HREF="ref.errorfunc.html#ini.docref-root"
>docref_root</A
> e
      <A
HREF="ref.errorfunc.html#ini.docref-ext"
>docref_ext</A
>.
     </P
></DD
><DT
><A
NAME="ini.docref-root"
></A
><CODE
CLASS="parameter"
>docref_root</CODE
>
     <A
HREF="language.types.string.html"
><B
CLASS="type"
>string</B
></A
></DT
><DD
><P
>&#13;      O novo formato de mensagens de erro em HTML produz mensagens que podem ser 
      clicadas e que direcionam o usuário para uma pagina descrevendo
      o erro ou a função que causou o erro. No caso de paginas de manual você pode 
      baixar o manual na sua língua e definir esta diretiva para a sua cópia local.
      Se a sua cópia local do manual podur ser acessada por '/manual/' você pode
      simplesmente usar <KBD
CLASS="userinput"
>docref_root=/manual/</KBD
>. Adicionalmente você
      deve definir docref_ext para ser igual a extensão da sua cópia
      <KBD
CLASS="userinput"
>docref_ext=.html</KBD
>. É possível usar referencias externas.
      Por exemplo, você pode usar
      <KBD
CLASS="userinput"
>docref_root=http://manual/en/</KBD
> ou
      <KBD
CLASS="userinput"
>docref_root="http://landonize.it/?how=url&#38;theme=classic&#38;filter=Landon
      &#38;url=http%3A%2F%2Fwww.php.net%2F"</KBD
>
     </P
><P
>&#13;      A maior parte do tempo você deve querer que o valor de docref_root termine com uma barra '/'.
      Mas veja o segundo exemplo acima o qual não tem ou não necessita isso.
     </P
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Nota: </B
>
       Isto é para suportar o seu desenvolvimento já que torna mais fácil encontrar a descrição
       de uma função. Entretando não deve ser usado em sistemas
       de produção (ex. sistemas conectados na internet).
      </P
></BLOCKQUOTE
></DIV
></DD
><DT
><A
NAME="ini.docref-ext"
></A
><CODE
CLASS="parameter"
>docref_ext</CODE
>
     <A
HREF="language.types.string.html"
><B
CLASS="type"
>string</B
></A
></DT
><DD
><P
>&#13;      Veja <A
HREF="ref.errorfunc.html#ini.docref-root"
>docref_root</A
>.
     </P
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Nota: </B
>
       O valor de docref_ext deve começar com um ponto '.'.
      </P
></BLOCKQUOTE
></DIV
></DD
><DT
><A
NAME="ini.error-prepend-string"
></A
><CODE
CLASS="parameter"
>error_prepend_string</CODE
>
     <A
HREF="language.types.string.html"
><B
CLASS="type"
>string</B
></A
></DT
><DD
><P
>&#13;      String para mostrar antes de uma mensagem de erro.
     </P
></DD
><DT
><A
NAME="ini.error-append-string"
></A
><CODE
CLASS="parameter"
>error_append_string</CODE
>
     <A
HREF="language.types.string.html"
><B
CLASS="type"
>string</B
></A
></DT
><DD
><P
>&#13;      String para mostrar após uma mensagem de erro.
     </P
></DD
><DT
><A
NAME="ini.error-log"
></A
><CODE
CLASS="parameter"
>error_log</CODE
>
     <A
HREF="language.types.string.html"
><B
CLASS="type"
>string</B
></A
></DT
><DD
><P
>&#13;      O nome do arquivo onde os erros do script serão logados. Se o
      valor especial <TT
CLASS="literal"
>syslog</TT
> é usado, os erros
      são enviados para o log do sistema. No Unix, isto indica
      syslog(3) e no Windows NT isto indica o log do evento. O log
      de sistema não é suportado no Windows 95. Veja também:
      <A
HREF="function.syslog.html"
><B
CLASS="function"
>syslog()</B
></A
>.
     </P
></DD
><DT
><A
NAME="ini.warn-plus-overloading"
></A
><CODE
CLASS="parameter"
>warn_plus_overloading</CODE
>
     <A
HREF="language.types.boolean.html"
><B
CLASS="type"
>boolean</B
></A
></DT
><DD
><P
>&#13;      Se ativado, esta opção faz o PHP mostrar um aviso quando o operador
      de adição (<TT
CLASS="literal"
>+</TT
>) é usado em strings.
      Isto é para tornar mais fácil encontrar scripts que precisam
      ser rescritos usando o operador de concatenação
      (<TT
CLASS="literal"
>.</TT
>).
     </P
></DD
></DL
></DIV
>
 </P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="errorfunc.constants"
>Constantes pré-definidas</A
></H1
><P
>&#13;As constantes listadas abaixo estão sempre disponíveis como parte do núcleo do PHP.
</P
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Nota: </B
>
    Você pode usar estes nomes de constantes no <TT
CLASS="filename"
>php.ini</TT
> mas não fora do
    PHP, como no <TT
CLASS="filename"
>httpd.conf</TT
>, aonde você 
    deve usar os valores.
   </P
></BLOCKQUOTE
></DIV
><DIV
CLASS="table"
><A
NAME="errorlevels"
></A
><P
><B
>Tabela 2. Erros e Log</B
></P
><TABLE
BORDER="1"
CLASS="CALSTABLE"
><COL><COL><COL><COL><THEAD
><TR
><TH
>Valor</TH
><TH
>Constante</TH
><TH
>Descrição</TH
><TH
>Nota</TH
></TR
></THEAD
><TBODY
><TR
><A
NAME="e-error"
></A
><TD
>1</TD
><TD
>&#13;      <TT
CLASS="constant"
><B
>E_ERROR</B
></TT
>
      (<A
HREF="language.types.integer.html"
><B
CLASS="type"
>integer</B
></A
>)
     </TD
><TD
>&#13;      Erros em tempo de execução fatais. Estes indicam erros que não podem ser
      recuperados, como problemas de alocação de memória.
      A execução do script é interrompida.
     </TD
><TD
>&nbsp;</TD
></TR
><TR
><A
NAME="e-warning"
></A
><TD
>2</TD
><TD
>&#13;      <TT
CLASS="constant"
><B
>E_WARNING</B
></TT
>
      (<A
HREF="language.types.integer.html"
><B
CLASS="type"
>integer</B
></A
>)
     </TD
><TD
>&#13;      Avisos em tempo de execução (erros não fatais). A execução do script
      não é interrompida.
     </TD
><TD
>&nbsp;</TD
></TR
><TR
><A
NAME="e-parse"
></A
><TD
>4</TD
><TD
>&#13;      <TT
CLASS="constant"
><B
>E_PARSE</B
></TT
>
      (<A
HREF="language.types.integer.html"
><B
CLASS="type"
>integer</B
></A
>)
     </TD
><TD
>&#13;      Erro em tempo de compilação. Erros gerados pelo interpretador.
     </TD
><TD
>&nbsp;</TD
></TR
><TR
><A
NAME="e-notice"
></A
><TD
>8</TD
><TD
>&#13;      <TT
CLASS="constant"
><B
>E_NOTICE</B
></TT
>
      (<A
HREF="language.types.integer.html"
><B
CLASS="type"
>integer</B
></A
>)
     </TD
><TD
>&#13;      Notícia em tempo de execução. Indica que o script encontrou alguma coisa que pode indicar um erro,
      mas que também possa acontecer durante a execução normal do script.
     </TD
><TD
>&nbsp;</TD
></TR
><TR
><A
NAME="e-core-error"
></A
><TD
>16</TD
><TD
>&#13;      <TT
CLASS="constant"
><B
>E_CORE_ERROR</B
></TT
>
      (<A
HREF="language.types.integer.html"
><B
CLASS="type"
>integer</B
></A
>)
     </TD
><TD
>&#13;      Erro fatal que acontece durante a inicialização do PHP. Este é parecido com
      <TT
CLASS="constant"
><B
>E_ERROR</B
></TT
>, exceto que é gerado pelo núcleo do PHP.
     </TD
><TD
>Desde PHP 4</TD
></TR
><TR
><A
NAME="e-core-warning"
></A
><TD
>32</TD
><TD
>&#13;      <TT
CLASS="constant"
><B
>E_CORE_WARNING</B
></TT
>
      (<A
HREF="language.types.integer.html"
><B
CLASS="type"
>integer</B
></A
>)
     </TD
><TD
>&#13;      Avisos (erros não fatais) que aconteçam durante a inicialização do PHP.
      Este é parecido com <TT
CLASS="constant"
><B
>E_WARNING</B
></TT
>, exceto que é gerado pelo núcleo
      do PHP.
     </TD
><TD
>Desde PHP 4</TD
></TR
><TR
><A
NAME="e-compile-error"
></A
><TD
>64</TD
><TD
>&#13;      <TT
CLASS="constant"
><B
>E_COMPILE_ERROR</B
></TT
>
      (<A
HREF="language.types.integer.html"
><B
CLASS="type"
>integer</B
></A
>)
     </TD
><TD
>&#13;      Erro fatal em tempo de compilação. Este é parecido com <TT
CLASS="constant"
><B
>E_ERROR</B
></TT
>,
      exceto que é gerado pelo Zend Scripting Engine.
     </TD
><TD
>Desde PHP 4</TD
></TR
><TR
><A
NAME="e-compile-warning"
></A
><TD
>128</TD
><TD
>&#13;      <TT
CLASS="constant"
><B
>E_COMPILE_WARNING</B
></TT
>
      (<A
HREF="language.types.integer.html"
><B
CLASS="type"
>integer</B
></A
>)
     </TD
><TD
>&#13;      Aviso em tempo de compilação. Este é parecido com
      <TT
CLASS="constant"
><B
>E_WARNING</B
></TT
>, exceto que é geredo pelo Zend
      Scripting Engine.
     </TD
><TD
>Desde PHP 4</TD
></TR
><TR
><A
NAME="e-user-error"
></A
><TD
>256</TD
><TD
>&#13;      <TT
CLASS="constant"
><B
>E_USER_ERROR</B
></TT
>
      (<A
HREF="language.types.integer.html"
><B
CLASS="type"
>integer</B
></A
>)
     </TD
><TD
>&#13;      Erro gerado pelo usuário. Este é parecido com
      <TT
CLASS="constant"
><B
>E_ERROR</B
></TT
>, exceto que é gerado pelo código PHP
      usando a função <A
HREF="function.trigger-error.html"
><B
CLASS="function"
>trigger_error()</B
></A
>.
     </TD
><TD
>Desde PHP 4</TD
></TR
><TR
><A
NAME="e-user-warning"
></A
><TD
>512</TD
><TD
>&#13;      <TT
CLASS="constant"
><B
>E_USER_WARNING</B
></TT
>
      (<A
HREF="language.types.integer.html"
><B
CLASS="type"
>integer</B
></A
>)
     </TD
><TD
>&#13;      Aviso gerado pelo usuário. Este é parecido com
      <TT
CLASS="constant"
><B
>E_WARNING</B
></TT
>, exceto que é gerado pelo código PHP
      usando a função <A
HREF="function.trigger-error.html"
><B
CLASS="function"
>trigger_error()</B
></A
>.
     </TD
><TD
>Desde PHP 4</TD
></TR
><TR
><A
NAME="e-user-notice"
></A
><TD
>1024</TD
><TD
>&#13;      <TT
CLASS="constant"
><B
>E_USER_NOTICE</B
></TT
>
      (<A
HREF="language.types.integer.html"
><B
CLASS="type"
>integer</B
></A
>)
     </TD
><TD
>&#13;      Notícia gerada pelo usuário. Este é parecido com
      <TT
CLASS="constant"
><B
>E_NOTICE</B
></TT
>, exceto que é gerado pelo código PHP
      usando a função  <A
HREF="function.trigger-error.html"
><B
CLASS="function"
>trigger_error()</B
></A
>.
     </TD
><TD
>Desde PHP 4</TD
></TR
><TR
><A
NAME="e-all"
></A
><TD
>2047</TD
><TD
>&#13;      <TT
CLASS="constant"
><B
>E_ALL</B
></TT
>
      (<A
HREF="language.types.integer.html"
><B
CLASS="type"
>integer</B
></A
>)
     </TD
><TD
>&#13;      Todos os erros e avisos, como suportado, exceto do nível
      <TT
CLASS="constant"
><B
>E_STRICT</B
></TT
>.
     </TD
><TD
>&nbsp;</TD
></TR
><TR
><A
NAME="e-strict"
></A
><TD
>2048</TD
><TD
>&#13;      <TT
CLASS="constant"
><B
>E_STRICT</B
></TT
>
      (<A
HREF="language.types.integer.html"
><B
CLASS="type"
>integer</B
></A
>)
     </TD
><TD
>&#13;      Nóticias em tempo de execução. Permite ao PHP sugerir modificações
      em seu código para segurar melhor interoperabilidade
      e compatibilidade futura do seu código.
     </TD
><TD
>Desde PHP 5</TD
></TR
></TBODY
></TABLE
></DIV
><P
>&#13;  Os valores acima (numéricos ou simbolicos) são usados para
  criar um bitmask que especifica quais erros reportar.Você pode usar os
  <A
HREF="language.operators.bitwise.html"
>operadores Bit-a-bit</A
>
  para combinar estes valores ou mascarar certos tipos de erro.
  Note que somente '|', '~', '!', '^' and '&#38;' serão ententidos dentro do
  <TT
CLASS="filename"
>php.ini</TT
>, entretanto, nenhum
  operador será entendido no <TT
CLASS="filename"
>php3.ini</TT
>.
 </P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="errorfunc.examples"
>Exemplos</A
></H1
><P
>&#13;   Abaixo você poderá ver um exemplo de como usar as capacidades de gerenciamento de erros no
   PHP. Nós definimos uma função para gerenciamento de erros a qual guardas as informações
   dentro de um arquivo (usando um formato XML), e envia um e-mail para o desenvolvador
   caso um erro crítico na lógica aconteça.
   <TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN43929"
></A
><P
><B
>Exemplo 1. Usando gerenciamento de erro em um script</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><code><font color="#000000">
<font color="#0000BB">&lt;?php<br /></font><font color="#FF8000">// nós iremos fazer o nosso próprio gerenciamento de erros<br /></font><font color="#0000BB">error_reporting</font><font color="#007700">(</font><font color="#0000BB">0</font><font color="#007700">);<br /><br /></font><font color="#FF8000">// função definida pelo usuário para gerenciamento de erros<br /></font><font color="#007700">function </font><font color="#0000BB">userErrorHandler</font><font color="#007700">(</font><font color="#0000BB">$errno</font><font color="#007700">, </font><font color="#0000BB">$errmsg</font><font color="#007700">, </font><font color="#0000BB">$filename</font><font color="#007700">, </font><font color="#0000BB">$linenum</font><font color="#007700">, </font><font color="#0000BB">$vars</font><font color="#007700">) <br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#FF8000">// timestamp para a entrada do erro<br />&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$dt </font><font color="#007700">= </font><font color="#0000BB">date</font><font color="#007700">(</font><font color="#DD0000">"Y-m-d H:i:s (T)"</font><font color="#007700">);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#FF8000">// Define uma matriz associativa com as strings dos erros<br />&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$errortype </font><font color="#007700">= array (<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">E_ERROR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">=&gt; </font><font color="#DD0000">"Error"</font><font color="#007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">E_WARNING&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">=&gt; </font><font color="#DD0000">"Warning"</font><font color="#007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">E_PARSE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">=&gt; </font><font color="#DD0000">"Parsing Error"</font><font color="#007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">E_NOTICE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">=&gt; </font><font color="#DD0000">"Notice"</font><font color="#007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">E_CORE_ERROR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">=&gt; </font><font color="#DD0000">"Core Error"</font><font color="#007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">E_CORE_WARNING&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">=&gt; </font><font color="#DD0000">"Core Warning"</font><font color="#007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">E_COMPILE_ERROR&nbsp;&nbsp;&nbsp;</font><font color="#007700">=&gt; </font><font color="#DD0000">"Compile Error"</font><font color="#007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">E_COMPILE_WARNING </font><font color="#007700">=&gt; </font><font color="#DD0000">"Compile Warning"</font><font color="#007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">E_USER_ERROR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">=&gt; </font><font color="#DD0000">"User Error"</font><font color="#007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">E_USER_WARNING&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">=&gt; </font><font color="#DD0000">"User Warning"</font><font color="#007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">E_USER_NOTICE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">=&gt; </font><font color="#DD0000">"User Notice"</font><font color="#007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">E_STRICT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">=&gt; </font><font color="#DD0000">"Runtime Notice"<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#FF8000">// define quais erros nós iremos salvar<br />&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$user_errors </font><font color="#007700">= array(</font><font color="#0000BB">E_USER_ERROR</font><font color="#007700">, </font><font color="#0000BB">E_USER_WARNING</font><font color="#007700">, </font><font color="#0000BB">E_USER_NOTICE</font><font color="#007700">);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$err </font><font color="#007700">= </font><font color="#DD0000">"&lt;errorentry&gt;\n"</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$err </font><font color="#007700">.= </font><font color="#DD0000">"\t&lt;datetime&gt;" </font><font color="#007700">. </font><font color="#0000BB">$dt </font><font color="#007700">. </font><font color="#DD0000">"&lt;/datetime&gt;\n"</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$err </font><font color="#007700">.= </font><font color="#DD0000">"\t&lt;errornum&gt;" </font><font color="#007700">. </font><font color="#0000BB">$errno </font><font color="#007700">. </font><font color="#DD0000">"&lt;/errornum&gt;\n"</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$err </font><font color="#007700">.= </font><font color="#DD0000">"\t&lt;errortype&gt;" </font><font color="#007700">. </font><font color="#0000BB">$errortype</font><font color="#007700">[</font><font color="#0000BB">$errno</font><font color="#007700">] . </font><font color="#DD0000">"&lt;/errortype&gt;\n"</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$err </font><font color="#007700">.= </font><font color="#DD0000">"\t&lt;errormsg&gt;" </font><font color="#007700">. </font><font color="#0000BB">$errmsg </font><font color="#007700">. </font><font color="#DD0000">"&lt;/errormsg&gt;\n"</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$err </font><font color="#007700">.= </font><font color="#DD0000">"\t&lt;scriptname&gt;" </font><font color="#007700">. </font><font color="#0000BB">$filename </font><font color="#007700">. </font><font color="#DD0000">"&lt;/scriptname&gt;\n"</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$err </font><font color="#007700">.= </font><font color="#DD0000">"\t&lt;scriptlinenum&gt;" </font><font color="#007700">. </font><font color="#0000BB">$linenum </font><font color="#007700">. </font><font color="#DD0000">"&lt;/scriptlinenum&gt;\n"</font><font color="#007700">;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;if (</font><font color="#0000BB">in_array</font><font color="#007700">(</font><font color="#0000BB">$errno</font><font color="#007700">, </font><font color="#0000BB">$user_errors</font><font color="#007700">)) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$err </font><font color="#007700">.= </font><font color="#DD0000">"\t&lt;vartrace&gt;" </font><font color="#007700">. </font><font color="#0000BB">wddx_serialize_value</font><font color="#007700">(</font><font color="#0000BB">$vars</font><font color="#007700">, </font><font color="#DD0000">"Variables"</font><font color="#007700">) . </font><font color="#DD0000">"&lt;/vartrace&gt;\n"</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$err </font><font color="#007700">.= </font><font color="#DD0000">"&lt;/errorentry&gt;\n\n"</font><font color="#007700">;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#FF8000">// para teste<br />&nbsp;&nbsp;&nbsp;&nbsp;// echo $err;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;// salva para o log de erros, e envia um email para o desenvolvedor em caso de erro crítico<br />&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">error_log</font><font color="#007700">(</font><font color="#0000BB">$err</font><font color="#007700">, </font><font color="#0000BB">3</font><font color="#007700">, </font><font color="#DD0000">"/usr/local/php4/error.log"</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;if (</font><font color="#0000BB">$errno </font><font color="#007700">== </font><font color="#0000BB">E_USER_ERROR</font><font color="#007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">mail</font><font color="#007700">(</font><font color="#DD0000">"phpdev@example.com"</font><font color="#007700">, </font><font color="#DD0000">"Critical User Error"</font><font color="#007700">, </font><font color="#0000BB">$err</font><font color="#007700">);<br />}<br /><br /><br />function </font><font color="#0000BB">distance</font><font color="#007700">(</font><font color="#0000BB">$vect1</font><font color="#007700">, </font><font color="#0000BB">$vect2</font><font color="#007700">)<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;if (!</font><font color="#0000BB">is_array</font><font color="#007700">(</font><font color="#0000BB">$vect1</font><font color="#007700">) || !</font><font color="#0000BB">is_array</font><font color="#007700">(</font><font color="#0000BB">$vect2</font><font color="#007700">)) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">trigger_error</font><font color="#007700">(</font><font color="#DD0000">"Incorrect parameters, arrays expected"</font><font color="#007700">, </font><font color="#0000BB">E_USER_ERROR</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return </font><font color="#0000BB">NULL</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;if (</font><font color="#0000BB">count</font><font color="#007700">(</font><font color="#0000BB">$vect1</font><font color="#007700">) != </font><font color="#0000BB">count</font><font color="#007700">(</font><font color="#0000BB">$vect2</font><font color="#007700">)) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">trigger_error</font><font color="#007700">(</font><font color="#DD0000">"Vectors need to be of the same size"</font><font color="#007700">, </font><font color="#0000BB">E_USER_ERROR</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return </font><font color="#0000BB">NULL</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;for (</font><font color="#0000BB">$i</font><font color="#007700">=</font><font color="#0000BB">0</font><font color="#007700">; </font><font color="#0000BB">$i</font><font color="#007700">&lt;</font><font color="#0000BB">count</font><font color="#007700">(</font><font color="#0000BB">$vect1</font><font color="#007700">); </font><font color="#0000BB">$i</font><font color="#007700">++) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$c1 </font><font color="#007700">= </font><font color="#0000BB">$vect1</font><font color="#007700">[</font><font color="#0000BB">$i</font><font color="#007700">]; </font><font color="#0000BB">$c2 </font><font color="#007700">= </font><font color="#0000BB">$vect2</font><font color="#007700">[</font><font color="#0000BB">$i</font><font color="#007700">];<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$d </font><font color="#007700">= </font><font color="#0000BB">0.0</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (!</font><font color="#0000BB">is_numeric</font><font color="#007700">(</font><font color="#0000BB">$c1</font><font color="#007700">)) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">trigger_error</font><font color="#007700">(</font><font color="#DD0000">"Coordinate $i in vector 1 is not a number, using zero"</font><font color="#007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">E_USER_WARNING</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$c1 </font><font color="#007700">= </font><font color="#0000BB">0.0</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (!</font><font color="#0000BB">is_numeric</font><font color="#007700">(</font><font color="#0000BB">$c2</font><font color="#007700">)) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">trigger_error</font><font color="#007700">(</font><font color="#DD0000">"Coordinate $i in vector 2 is not a number, using zero"</font><font color="#007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">E_USER_WARNING</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$c2 </font><font color="#007700">= </font><font color="#0000BB">0.0</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$d </font><font color="#007700">+= </font><font color="#0000BB">$c2</font><font color="#007700">*</font><font color="#0000BB">$c2 </font><font color="#007700">- </font><font color="#0000BB">$c1</font><font color="#007700">*</font><font color="#0000BB">$c1</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;return </font><font color="#0000BB">sqrt</font><font color="#007700">(</font><font color="#0000BB">$d</font><font color="#007700">);<br />}<br /><br /></font><font color="#0000BB">$old_error_handler </font><font color="#007700">= </font><font color="#0000BB">set_error_handler</font><font color="#007700">(</font><font color="#DD0000">"userErrorHandler"</font><font color="#007700">);<br /><br /></font><font color="#FF8000">// constante indefinida, gera um aviso<br /></font><font color="#0000BB">$t </font><font color="#007700">= </font><font color="#0000BB">I_AM_NOT_DEFINED</font><font color="#007700">;<br /><br /></font><font color="#FF8000">// define alguns "vetores"<br /></font><font color="#0000BB">$a </font><font color="#007700">= array(</font><font color="#0000BB">2</font><font color="#007700">, </font><font color="#0000BB">3</font><font color="#007700">, </font><font color="#DD0000">"foo"</font><font color="#007700">);<br /></font><font color="#0000BB">$b </font><font color="#007700">= array(</font><font color="#0000BB">5.5</font><font color="#007700">, </font><font color="#0000BB">4.3</font><font color="#007700">, -</font><font color="#0000BB">1.6</font><font color="#007700">);<br /></font><font color="#0000BB">$c </font><font color="#007700">= array(</font><font color="#0000BB">1</font><font color="#007700">, -</font><font color="#0000BB">3</font><font color="#007700">);<br /><br /></font><font color="#FF8000">// gera um erro do usuário<br /></font><font color="#0000BB">$t1 </font><font color="#007700">= </font><font color="#0000BB">distance</font><font color="#007700">(</font><font color="#0000BB">$c</font><font color="#007700">, </font><font color="#0000BB">$b</font><font color="#007700">) . </font><font color="#DD0000">"\n"</font><font color="#007700">;<br /><br /></font><font color="#FF8000">// gera outro erro do usuário<br /></font><font color="#0000BB">$t2 </font><font color="#007700">= </font><font color="#0000BB">distance</font><font color="#007700">(</font><font color="#0000BB">$b</font><font color="#007700">, </font><font color="#DD0000">"i am not an array"</font><font color="#007700">) . </font><font color="#DD0000">"\n"</font><font color="#007700">;<br /><br /></font><font color="#FF8000">// gera um aviso<br /></font><font color="#0000BB">$t3 </font><font color="#007700">= </font><font color="#0000BB">distance</font><font color="#007700">(</font><font color="#0000BB">$a</font><font color="#007700">, </font><font color="#0000BB">$b</font><font color="#007700">) . </font><font color="#DD0000">"\n"</font><font color="#007700">;<br /><br /></font><font color="#0000BB">?&gt;</font>
</font>
</code></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
>
  </P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="errorfunc.seealso"
>Veja também</A
></H1
><P
>&#13;     Veja também <A
HREF="function.syslog.html"
><B
CLASS="function"
>syslog()</B
></A
>.
    </P
></DIV
></DIV
><DIV
CLASS="TOC"
><DL
><DT
><B
>Índice</B
></DT
><DT
><A
HREF="function.debug-backtrace.html"
>debug_backtrace</A
>&nbsp;--&nbsp;
     Gera um backtrace
    </DT
><DT
><A
HREF="function.debug-print-backtrace.html"
>debug_print_backtrace</A
>&nbsp;--&nbsp;
     Mostra um backtrace
    </DT
><DT
><A
HREF="function.error-get-last.html"
>error_get_last</A
>&nbsp;--&nbsp;Get the last occurred error</DT
><DT
><A
HREF="function.error-log.html"
>error_log</A
>&nbsp;--&nbsp;Envia uma mensagem de erro para algum lugar</DT
><DT
><A
HREF="function.error-reporting.html"
>error_reporting</A
>&nbsp;--&nbsp;Define quais erros serão reportados</DT
><DT
><A
HREF="function.restore-error-handler.html"
>restore_error_handler</A
>&nbsp;--&nbsp;
     Restaura a função anterior para gerenciamento de erro
    </DT
><DT
><A
HREF="function.restore-exception-handler.html"
>restore_exception_handler</A
>&nbsp;--&nbsp;
   Restauda a função tratadora de exceções anterior.
  </DT
><DT
><A
HREF="function.set-error-handler.html"
>set_error_handler</A
>&nbsp;--&nbsp;
     Define uma função do usuário para manusear os erros.
    </DT
><DT
><A
HREF="function.set-exception-handler.html"
>set_exception_handler</A
>&nbsp;--&nbsp;
   Define uma função definida pelo usuário para tratamento de exceções
  </DT
><DT
><A
HREF="function.trigger-error.html"
>trigger_error</A
>&nbsp;--&nbsp;
     Gera uma mensagem de usuário sobre error/warning/notice
    </DT
><DT
><A
HREF="function.user-error.html"
>user_error</A
>&nbsp;--&nbsp;Apelido para <A
HREF="function.trigger-error.html"
><B
CLASS="function"
>trigger_error()</B
></A
></DT
></DL
></DIV
></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="function.enchant-dict-suggest.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.debug-backtrace.html"
ACCESSKEY="N"
>Próxima</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>enchant_dict_suggest</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="funcref.html"
ACCESSKEY="U"
>Acima</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>debug_backtrace</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>