PHP Manual
Prev | Appendix C. Migrating from PHP 3 to PHP 4 | Next

# Parser behavior

Parsing and execution are now two completely seperated steps, no execution of a files code will happen until the complete file and everything it requires has completely and successfully been parsed.

One of the new requirenments introduced with this split is that required and included files now have to be syntactically complete. You can no longer spread the different controling parts of a control structure across file boundaries. That is you cannot start a `for` or `while` loop, an `if` statement or a `switch` block in one file and have the end of loop, `else`, `endif`, `case` or `break` statements in a different file.

It still perfectly legal to include additional code within loops or other control structures, only the controling keywords and corresponding curly braces `{...}` have to be within the same compile unit (file or eval()ed string).

This should not harm to much as spreading code like this should be considered as very bad style anyway.

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.

Prev | Home | Next
Migrating Configuration Files | Up | Error reporting