Basic Syntax of PHP

Hi I’m Ali Hassan from Telecom Academy. We have provided you the introduction of PHP MySQL and XAMPP installation. Now we will discuss about the Basic Syntax of PHP. We will use Notepad ++ for writing PHP. Its unique feature is that it contains lining number and you can easily find the error in the code. Other notepad does not contains line number which causes problems on executing the code.




Always remember without HTML setup you can write the PHP code. You can get direct output using PHP. But often you have to use HTML for creating Pages in PHP. We cannot ignore HTML as it is more necessary in important cases for designing the pages.







We have inserted the basic structure of the HTML. The important section in the HTML is the Head section. It contains important information about your website. It may contains meta tags and sensitive information and links like JavaScript external scripts are included in Head. Body contains the stuff you want to show on the browser. If you write the body stuff in the Head section.

PHP syntax using NotePad++

Now I’m going to tell you an important tip that there is no rule in PHP that we use the PHP tags after HTML , after Head or After Body,. We can write PHP scripts/tags anywhere we want. But if you have to show the data from the database in a special section. Then you have to write the PHP code in the specific area.

As you can write the PHP code anywhere, following is the Basic Syntax for PHP

<html>

              <head>

                             <title> Telecom Academy</title>

                             <meta name=”keywords” content=”Innovation in connecting the world”>

              </head>

<body>              

<?php

?>


 

Basic Syntax of PHP contains the PHP starting tag and ending tag. It is written with the less than sign ‘<’ and question mark and ends with the question mark and greater then sign’>’. You can write the PHP code scripts between this Basic Syntax.

This is Basic Syntax of PHP 5. In PHP 4 you can write this syntax without using the PHP tag. But for running PHP important commands above Basic Syntax must be used to execute the commands.

You may also see the

Complete & Projects based PHP + MySQL Training

Ali Hassan

Smart, Motivated, Tech_Geek, Versatile, Adrenaline_junkie, Hard_Working 🙂

Leave a comment

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