How to Solve Syntax Error in PHP

In this article I will tell what is the syntax and how to write basic PHP code, how we can accommodate PHP code in an HTML file and how to run PHP script and check in the output of browser.

A syntax error is an error in the source code a programming language of php. Since computer programs must follow strict syntax to compile correctly, any facet of the code that do not integrate to the syntax of the programming language will assemble a syntax error.

You must have installed XAMPP and run in the php script for working  If you have not installed  XAMPP, then go to this link XAMPP first Download and install in your pc.

Hello World script in PHP

The  php all code is written inside php code tags which is <?php and ?>. And the file with php code is saved with an extansion.php.  see the simple example below:

<? php echo "Hello World...";?>

Unlike rationale errors, which are errors in the flow or logic of a program, syntax errors are small grammatical mistakes, recurrently limited to a single character. For example, a missing semicolon in the end of a line or an extra bracket in the end of a function may produce a syntax error. In the PHP code below, the second closed bracket would result in a syntax error since there is only one open bracket in the function.

function Thewholeblogs{
echo "";

Leave a Comment