PHP Tutorial – Learning the PHP Syntax

PHP scripts are enclosed within a start and end tag. PHP scripts are embedded in a HTML document and you can place the PHP codes anywhere in the document.

x
Demo - Online School Documents Processing System Free Bootstrap Template

The two forms of PHP scripting block:

  • The shorthand form starts with <? and end with ?>.
  • The standard form which is the recommended to use <?php ?>.

Here is the example of the PHP script embedded in the HTML document:

<html>
<title>My First PHP script</title>
<body>
<?php echo "hi guys!"; ?> </body>
</html>

echo is used to display/output the text to the browser.

Note: place a semicolon at the end of your PHP scripts and the save the file with a .php extension.

Save the file as myFirstPHPcode.php and place the file in the web root of your web server, i.e. c:\wamp\www

, , , ,

Post navigation

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.