Back to questions
JuniorTheoryCommon
What happens when you run this program?
<?php
echo "start\n";
echo "middle\n"
echo "end\n";Nothing: a parse error, the file never runs
- Expecting the lines above the broken one to print: PHP parses the whole file before running it, so after a parse error not even
startappears. - Expecting a line break to end a statement: in PHP only
;ends one, so line 4 runs into theechoon line 5 and the file cannot be parsed.
- Which line does PHP name in this error message, and why is it not line 4?
- How does a parse error differ from a
Fatal errorsuch as an undefined constant?