PHP syntax and semantics are similar to most other programming languages (C, Java, Perl) with the addition that all PHP code is contained with a tag, of sorts. All PHP code must be contained within the following…
Some coding here......
or the shorthand PHP tag. i.e
Some php coding here
Note: If you are writing PHP scripts and plan on distributing them, we suggest that you use the standard php syntax (which includes the <?php) rather than the shorthand php syntax. This will ensure that your scripts will work, even when running on other servers with different settings.
How to save your php pages
If you have PHP inserted into your HTML and want the web browser to interpret it correctly, then you must save the file with aÂ .phpÂ extension, instead of the standardÂ .htmlÂ extension. So be sure to check that you are saving your files correctly. Instead ofÂ index.html, it should beÂ index.phpÂ if there is PHP code in the file.
Example html & php page
Below is an example of one of the easiest PHP and HTML page that you can create and still follow web standards.
<title>My first PHP page-tutsocean.com</title>
echo "<h2>This is my first code in php.</h2>";
This is how to use PHP Syntax.
If you have any question, ask it at our Forum Section.