An Introduction To PHP

What is PHP?
  • PHP stands for Hyper Text Preprocessor.
  • It is an Open-Source widely used scripting language.
  • It works on server side scripting language.
  • It is easy to use and free to download.
What is PHP File?
  • It the combination of HTML, CSS, and JavaScript, along with PHP Code.
  • It has an extension as ".php".
Why PHP?
  • It supports and runs on various platfoms (Windows, Linux, Unix, etc.).
  • It is compatible with all servers used to date (XAMPP, Apache, etc.).
  • It supports a wide range of databases.
  • It is free to download from the official site of PHP:www.php.net.
PHP Syntax
 
Basic PHP Syntax
  • The PHP script starts with<?phpand it ends with?>
  • It can be placed anywhere in the document..

    <?php
       //PHP Code
    ?>
  • Here is the  first most basic coding for PHP.
  • I have written the basic code to print "ALL THE BEST".
Is PHP Case-Sensitive?
  • In PHP, classes, functions, keywords (eg: echo, if, else, etc..), user-defined functions are case sensitive.
PHP Comments
  • The Comment lines are used to make the code more understandable and for ease of use.
  • Mostly, Command lines let others understand your code.
  • Most programmers have a habit of looking back on their own code for future reference.
  • The comment lines helps you to remind you what you were thinking, when you wrote the code.
Two types of Comment Lines
  • Single Line Comment(// , #)
    1. <?php  
    2.   // This is a single-line comment  
    3.   # This is also a single-line comment  
    4. ?>  
  • Multiple Line Comment (/*...*/
    1. <?php  
    2.   /* 
    3.     This is a multiple-lines comment 
    4.   */  
    5. ?>  
These are all the basics for an Introduction to PHP.
 
Here I have attached example coding for the above topics. Kindly refer to it.
 
Thank you!.