Basic Syntax of PHP With Example

Definition of PHP

The PHP Stands for Hypertext Pre-processor. PHP is a programming language that allows web developers to create dynamic content that interacts with databases.

PHP is basically used for developing web based software applications. PHP is probably the most popular scripting language on the web. It is used to enhance web pages.

PHP is known as server-sided language. That is because the PHP dosen't get executed on the client's computer, but on the computer the user had requested the page from. The results are then handed over to client, and then displayed in the browser.

Basic Syntax:




Example:



Result:


  My first PHP page
  Welcome to aimtocode

Comments:Single Line



Result:


  Welcome to aimtocode
 

Comment: Multi Line



Result:

   Welcome to aimtocode

Rules of PHP

  • PHP is white space insensitive
  • PHP is case sensitive
  • Statements are expressions terminated by semicolons
  • Expressions are combinations of tokens
  • Braces make blocks