PHP Menu

PHP Program

This tutorial gives detailed information about how to create and execute a PHP program.

To create PHP program, we need basic knowledge of Hyper Text Markup Language (HTML) to generate static content.

To create and execute a PHP Program,


  • Open any text editor (like notepad, edit plus ...).
  • Write PHP script and Html tags in that text editor.
  • Save this file with ".php" extension in the following location.

    In Windows:
    C: /xampp/htdocs
    In Linux (Ubuntu):


  • Open the XAMPP control panel and then start the Apache server.
  • Open any web browser (Chrome, Firefox ,IE..) and type "localhost/filename.php" as url in the address bar.
  • Then we get an output of PHP programs.

The PHP file is the combination of HTML and PHP script, where HTML generates static content and PHP generates dynamic content.

To insert or embed PHP script into html document, we use PHP tag.

Format of PHP tag is

 Note : In PHP, each statement ends with semicolon ( ; ).

echo statement :

The echo statement is used to print something on screen just like print function C language.


echo "Hello Welcome !";
echo "Hello ".10*3;

Hello Welcome !
Hello 30

 Note: In PHP, . (dot) symbol is used to concatenate two strings.

Example: "First.php"


<title>First PHP Example</title>
echo "This is My First PHP Example";  

Output :

Next Topic :Comments in PHP