PHP Tutorials, Concepts, Tips & Interview Questions

PHP is a powerful tool for making dynamic and interactive Web pages.
PHP is the widely-used, free, and efficient alternative to competitors such as Microsoft’s ASP.
PHP is a server-side scripting language.PHP (Hypertext Preprocessor) is an open source, server-side, HTML embedded scripting language used to create dynamic Web pages. PHP script is embedded within a HTML document and the programmer can jump between HTML and PHP seamlessly within the document while the code remains inaccessible to users since it is processed on the server. It combines the power of CGI scripting with the ease of working within HTML.

What You Should Already Know
Before you continue you should have a basic understanding of the following:

  • JavaScript

What is PHP?

  • PHP stands for PHP: Hypertext Preprocessor
  • PHP is a server-side scripting language, like ASP
  • PHP scripts are executed on the server
  • PHP supports many databases (MySQL, Informix, Oracle, Sybase, Solid, PostgreSQL, Generic ODBC, etc.)

What is a PHP File?

  • PHP files can contain text, HTML tags and scripts
  • PHP files are returned to the browser as plain HTML
  • PHP files have a file extension of “.php”, “.php3”, or “.phtml”

Basic PHP Syntax
A PHP scripting block always starts with <?php and ends with ?>. A PHP scripting block can be placed anywhere in the document.
A PHP file normally contains HTML tags, just like an HTML file, and some PHP scripting code.
Below, we have an example of a simple PHP script which sends the text “Hello World” to the browser:


  • Each code line in PHP must end with a semicolon.
    The semicolon is a separator and is used to distinguish one set of instructions from another.
  • There are two basic statements to output text with PHP: echo and print.
    In the example above we have used the echo statement to output the text “Hello Enjoy the ride”.
  • The file must have a .php extension.
    If the file has a .html extension, the PHP code will not be executed.

It is also helpful to think of PHP in terms of what it can do for you. PHP offers several key advantages:

  • Reduce the time to create large websites.
  • Create a customized user experience for visitors based on information that you have gathered
  • Open up thousands of possibilities for online tools.
  • Allow creation of shopping carts for e-commerce websites.
  • Cross-platform operability
  • Compatibility with a wide variety of databases
  • Support for most current web servers
  • Communicates with numerous network protocols
  • Not limited to HTML output
  • Strong text processing capabilities