PHP Intro


- Advertisement -

PHP is a server-side scripting language designed specifically for the web. Within an HTML page, you can embed PHP code that will be executed each time the page is visited. Your PHP code is interpreted at the web server and generates HTML or other output that the visitor will see.
A PHP file is just  a HTML file saved using  .php extension instead of .html or .htm extension, which tells the server to looking  the page for code.
PHP is a language  that can be used to create dynamic web pages, In fact that is the whole point of PHP.
Static Vs Dynamic web pages
A static  web page never change, unless a person specifically edit the page.
A dynamic web page can be diffrent every time it is viewed by a browser because the sever edits the page prior to sending it to the browser accordingly to what instructions the programmer has  coded into that specific page.
PHP was introduced in 1994. As of November 2007, it was installed on more than 21 million domains worldwide, and this number is growing rapidly. You can see the current number at
PHP is an Open Source project. PHP originally stood for Personal Home Page and now stands for PHP Hypertext Preprocessor.
A Simple PHP Script

Output: Hello Web!
Beginning and Ending a Block of PHP Statements
When writing PHP, you need to inform the PHP engine that you want it to execute your commands. If you don’t do this, the code you write will be mistaken for HTML and will be output to the browser. You can designate your code as PHP with special tags that mark the beginning and end of PHP code blocks.
shows four such PHP delimiter tags.

Tag Style Start Tag End Tag
Standard tags <?php ?>
Short tags <? ?>
ASP tags <% %>
Script tags <SCRIPT LANGUAGE=”php”> </SCRIPT>

Example 1  :

Example 2 :

Example  3 :

Example 4 :

You can also put single lines of code in PHP on the same line as the PHP start and end tags:

Combining HTML and PHP
A PHP Script Incorporated into HTML

As you can see, incorporating PHP code into a predominantly HTML document is simply a matter of typing in the code. The PHP engine ignores everything outside the PHP open and close tags.
You can include as many blocks of PHP code as you need in a single document, interspersing them with HTML as required. Although you can have multiple blocks of code in a single document, they combine to form a single script. Any variables defined in the first block will usually be available to subsequent blocks.

- Advertisement -

Leave A Reply

Your email address will not be published.

  1. […] this tutorials we will about regular expressions in PHP and how a programmer can apply them in pattern matching. What is Regular Expression? They are […]

  2. […] In this tutorial, We will learn how to fund the factorial of a number using PHP. […]

  3. […] this project, we use PHP and  MySQL database. It has two […]

  4. […] write PHP Code for user registration/signup. In this process, we will check the user email is registered with […]

  5. prathamesh zore. says

    Hii Anuj Kumar ji Thank you so much for sharing this tutorials and your projects.

  6. samir mahato says

    one of the best php learning website. wonderful

  7. Prashant sarvaiya says

    Please give project on old age home system with php code and my sql data base

    1. Anuj Kumar says

      I will upload soon

  8. Manu says

    please post regarding REST API

    1. Anuj Kumar says

      I will upload it soon.

  9. Joshua says

    It is always wonderful to learn from the best sites……
    thanks Anuj Kumar for your great work. this has really helped us to love programming at large. Great work to all PHPGURUKUL community

  10. akash says

    student fee management system (require)

    1. Anuj Kumar says

      Right now, It’s not available.

  11. neha says

    hey anuj. your blog is awesome and very helpful. there’s just one request of mine, can you please make a tutorial on cakephp? the way you present the concept is way more understanding than other blogs.

    1. Anuj Kumar says

      I will post soon.

Leave A Reply

Your email address will not be published.