Parse Error Syntax Error Unexpected End of File in PHP

Parse Error Syntax Error. How to solve the PHP errors like unexpected end of file. This error occurs most of the time and user confused how to solve it. Learn it now.


PHP will took your programming to another peak, some of them enjoyed and some feel confused. But when you are testing the output result which occurs an error like Parse Error: Syntax Error. All the output goes away. One of the common programming error in PHP is mentioned below every beginner/expert got this error.

“( ! ) Parse error: syntax error, unexpected $end in C:\wamp\www\projectname\filename.php on line any-line-number”

What is the solutions for that ? usually unexpected end of file $end occurs when you forgot the curli bracket at the end like if you write

if ( $abc ==1){
<h1>Parse error: syntax error check</h1>

Now you can clearly see you forgot closing Bracket } because if condition is not closed properly. you code should be like this

if ( $abc ==1){
<h1>Parse error: syntax error check</h1>
<?php } ?>

Other expected problems are listed below i explain 2nd point above in example.

People Who also Read this Post: Post Get Default Timezone in PHP

  • Parse error or syntax error occurs when you missed bracket ( } ) at the end.
  • When you write if condition and forgot the parenthesis ) -.
    <?php if (isset($A){
    echo "parse error: syntax error will happen ";

    Now see you forgot ) before { because you open two parenthesis before isset and after isset and you close single parenthesis.

  • At the end of line Forgot the Semicolon ( ; ).
  • Check every comma because you declare array and forgot Comma ( , ).
  • Concatenation error suppose if you echo two variable without Concatenation Dot ( . ).

Hope this will solve your problem if any other errors occurs then write a comment. we are here to help you.

Leave a Reply

Your email address will not be published. Required fields are marked *