<HTML ><HEAD ><TITLE >Parser behavior</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="PHP Manual" 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=ISO-8859-1"></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" >PHP Manual</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="migration4.configuration.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" >Appendix B. Migrating from PHP 3 to PHP 4</TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="migration4.error-reporting.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="migration4.parser" ></A >Parser behavior</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 to 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" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="migration4.error-reporting.html" ACCESSKEY="N" >Next</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" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Error reporting</TD ></TR ></TABLE ></DIV ></BODY ></HTML >