<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >php_check_syntax</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="Miscelânea" HREF="ref.misc.html"><LINK REL="PREVIOUS" TITLE="pack" HREF="function.pack.html"><LINK REL="NEXT" TITLE="php_strip_whitespace" HREF="function.php-strip-whitespace.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.pack.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.php-strip-whitespace.html" ACCESSKEY="N" >Próxima</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.php-check-syntax" ></A >php_check_syntax</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN121677" ></A ><P > (PHP 5 <= 5.0.4)</P >php_check_syntax -- Check the PHP syntax of (and execute) the specified file </DIV ><DIV CLASS="refsect1" ><A NAME="AEN121680" ></A ><H2 >Descrição</H2 >bool <B CLASS="methodname" >php_check_syntax</B > ( string filename [, string &error_message] )<BR ></BR ><P > Performs a syntax (lint) check on the specified <CODE CLASS="parameter" >filename</CODE > testing for scripting errors. </P ><P > This is similar to using <B CLASS="command" >php -l</B > from the <A HREF="features.commandline.html" >commandline</A > except that this function will execute (but not output) the checked <CODE CLASS="parameter" >filename</CODE >. </P ><P > For example, if a function is defined in <CODE CLASS="parameter" >filename</CODE >, this defined function will be available to the file that executed <B CLASS="function" >php_check_syntax()</B >, but output from <CODE CLASS="parameter" >filename</CODE > will be suppressed. </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Nota: </B > For technical reasons, this function is deprecated and removed from PHP. Instead, use <TT CLASS="literal" >php -l somefile.php</TT > from the <A HREF="features.commandline.html" >commandline</A >. </P ></BLOCKQUOTE ></DIV ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN121705" ></A ><H2 >Parâmetros</H2 ><P > <P ></P ><DIV CLASS="variablelist" ><DL ><DT ><CODE CLASS="parameter" >filename</CODE ></DT ><DD ><P > The name of the file being checked. </P ></DD ><DT ><CODE CLASS="parameter" >error_message</CODE ></DT ><DD ><P > If the <CODE CLASS="parameter" >error_message</CODE > parameter is used, it will contain the error message generated by the syntax check. <CODE CLASS="parameter" >error_message</CODE > is passed by <A HREF="language.references.html" >reference</A >. </P ></DD ></DL ></DIV > </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN121722" ></A ><H2 >Valores de retornado</H2 ><P > Returns <TT CLASS="constant" ><B >TRUE</B ></TT > if the lint check passed, and <TT CLASS="constant" ><B >FALSE</B ></TT > if the link check failed or if <CODE CLASS="parameter" >filename</CODE > cannot be opened. </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN121728" ></A ><H2 >Histórico</H2 ><P > <DIV CLASS="informaltable" ><P ></P ><A NAME="AEN121731" ></A ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><THEAD ><TR ><TH >Versão</TH ><TH >Descrição</TH ></TR ></THEAD ><TBODY ><TR ><TD >5.0.5</TD ><TD > This function was removed from PHP. </TD ></TR ><TR ><TD >5.0.3</TD ><TD > Calling <A HREF="function.exit.html" ><B CLASS="function" >exit()</B ></A > after <B CLASS="function" >php_check_syntax()</B > resulted in a Segfault. </TD ></TR ><TR ><TD >5.0.1</TD ><TD > <CODE CLASS="parameter" >error_message</CODE > is passed by reference. </TD ></TR ></TBODY ></TABLE ><P ></P ></DIV > </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN121750" ></A ><H2 >Exemplos</H2 ><P > <TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="screen" >php -l somefile.php</PRE ></TD ></TR ></TABLE > </P ><P >O exemplo acima irá imprimir algo similar a:</P ><P > <TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="screen" >PHP Parse error: unexpected T_STRING in /tmp/somefile.php on line 81</PRE ></TD ></TR ></TABLE > </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN121757" ></A ><H2 >Veja também</H2 ><P > <P ></P ><TABLE BORDER="0" ><TBODY ><TR ><TD ><A HREF="function.include.html" ><B CLASS="function" >include()</B ></A ></TD ></TR ><TR ><TD ><A HREF="function.is-readable.html" ><B CLASS="function" >is_readable()</B ></A ></TD ></TR ></TBODY ></TABLE ><P ></P > </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.pack.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.php-strip-whitespace.html" ACCESSKEY="N" >Próxima</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >pack</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.misc.html" ACCESSKEY="U" >Acima</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >php_strip_whitespace</TD ></TR ></TABLE ></DIV ></BODY ></HTML >