<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >Parser behavior</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="Migrating from PHP 3 to PHP 4" HREF="migration4.html"><LINK REL="PREVIOUS" TITLE="Migrating Configuration Files" HREF="migration4.configuration.html"><LINK REL="NEXT" TITLE="Error reporting" HREF="migration4.error-reporting.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8"></HEAD ><BODY CLASS="section" 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="migration4.configuration.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" >Apêndice D. Migrating from PHP 3 to PHP 4</TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="migration4.error-reporting.html" ACCESSKEY="N" >Próxima</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="migration4.parser" >Parser behavior</A ></H1 ><P > Parsing and execution are now two completely separated steps, no execution of a files code will happen until the complete file and everything it requires has completely and successfully been parsed. </P ><P > One of the new requirements introduced with this split is that required and included files now have to be syntactically complete. You can no longer spread the different controlling parts of a control structure across file boundaries. That is you cannot start a <TT CLASS="literal" >for</TT > or <TT CLASS="literal" >while</TT > loop, an <TT CLASS="literal" >if</TT > statement or a <TT CLASS="literal" >switch</TT > block in one file and have the end of loop, <TT CLASS="literal" >else</TT >, <TT CLASS="literal" >endif</TT >, <TT CLASS="literal" >case</TT > or <TT CLASS="literal" >break</TT > statements in a different file. </P ><P > It still perfectly legal to include additional code within loops or other control structures, only the controlling keywords and corresponding curly braces <TT CLASS="literal" >{...}</TT > have to be within the same compile unit (file or <A HREF="function.eval.html" ><B CLASS="function" >eval()</B ></A >ed string). </P ><P > This should not harm too much as spreading code like this should be considered as very bad style anyway. </P ><P > Another thing no longer possible, though rarely seen in PHP 3 code is returning values from a required file. Returning a value from an included file is still possible. </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="migration4.configuration.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="migration4.error-reporting.html" ACCESSKEY="N" >Próxima</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >Migrating Configuration Files</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="migration4.html" ACCESSKEY="U" >Acima</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Error reporting</TD ></TR ></TABLE ></DIV ></BODY ></HTML >