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 the browser. Solve Syntax Error in PHP?

A syntax error is an error in the source code of a programming language of PHP. Since computer programs must follow strict syntax to compile correctly, any facet of the code that does 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 on your pc.

Hello World script in PHP

All the PHP code is written inside PHP code tags which are <?php and ?>. And the file with PHP code is saved with an extensionPHP. solve syntax error in PHP  sees 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 at the end of a line or an extra bracket at 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 "wholeblogs.com";
}

Leave a Comment