Parse error: syntax error, unexpected

There is an common php error that is very irritating for beginners syntax error

Parse error: syntax error, unexpected ……

fixing this error is so easy you just have to put a semicolon (;) at the end of each line in PHP. We also say it, line terminator.

For example

we are getting error looks like.

Parse error: syntax error, unexpected ‘echo’ (T_ECHO) in D:\server\htdocs\tools\error.php on line 3

read the error carefully it says unexpected echo it means that I miss a semicolon before echo.

It’s because of i didn’t entered a semicolon in end of line.

<?php
    $variable ="Hello, world!"
    echo $varible
?>

that caused me an error in my PHP file. I just have to enter a semicolon at end of every PHP line of code ads line terminator Like

<?php
    $variable ="Hello, world!";
    echo $varible;
?>

As you can see it was so easy. Never lose hope while programming because there is always a solution for a problem

The error didn’t resolve? leave a comment I will get to you asap

Tagged :

2 thoughts on “Parse error: syntax error, unexpected

Leave a Reply

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