What is PHP?
The acronym PHP initially stood for Personal Home Page.
As of version 3, it stands for PHP Hypertext Preprocessor. It is a general purpose server side scripting language that is used to develop:
- Dynamic Websites
- Custom Web Portal (Like ERP, CRM)
- Web Applications
- E-commerce Websites (Like Flipkart, Amazon, Paytm, Snapdeal etc)
- CMS – Content Management System
Importance of PHP?
- It costs low with cost effective database applications
- It is platform independent
- PHP supports all major web servers
- The existence of multiple security layers make PHP one of the most secure options for developing the most critical websites and web applications.
- PHP supports a wide array of databases including dataBase, MySQL etc.
History of PHP
- Designed by Rasmus Lerdorf
- Developer The PHP Development Team, Zend Technologies
- First appeared June 8, 1995; 21 years ago
- Stable release 7.1.0/ December 1, 2016
Basic Structure of PHP
<?php
//your code here
?>
Example:
<!doctype html> <html> <head><title>Hello World Script</title></head> <body> <?php echo "<p>Hello World!</p>"; ?> </body> </html>
Printing statement in PHP
If you want to print/echo some string/variable or number in php
<?php $variable = "your string"; // echo $variable; // ?>
File Extension of PHP
-
PHP files have the file extension .php
Comment Line in PHP
- Single Line Comments
Single line comments start with //.
Any text between // and the end of the line will be ignored by PHP(will not be executed).
Example
echo 'This is a test'; // This is a one-line c++ style comment
- Multi-line Comments
Multi-line comments start with /* and end with */.
Any text between /* and */ will be ignored by PHP.
Example
/* This is a multi line comment yet another line of comment */ /* echo 'This is yet another test'; echo 'Hi'; */ echo 'One Final Test'; # This is a one-line shell-style comment
Variable Declaration
In PHP, a variable starts with the $ sign, followed by the name of the variable:
Example
<?php $Vraiable_name = "Hello world!"; $x = 5; $y = 10.5; ?>
A variable can have a short name (like x and y) or a more descriptive name (age, car name, total_volume).
Rules for PHP variables:
- A variable starts with the $ sign, followed by the name of the variable
- A variable name must start with a letter or the underscore character
- A variable name cannot start with a number
- A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ )
- Variable names are case-sensitive ($age and $AGE are two different variables)
Mother Sparsh 99% Pure Water (Unscented) Baby Wipes with Lid I Natural Plant made cloth - Super thick Wet Wipes I 72 pcs/pack - Pack of 2 (Super Saver Pack)
₹397.00 (as of March 25, 2026 11:12 GMT +05:30 - More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)Huggies Complete Comfort Wonder Pants | Pant Style Baby Diapers Extra Large Size (XL), 56 Count | India's Fastest Absorbing Diaper, Prevents Diaper Rash, Ideal for 12 to 17 Kgs
₹644.00 (as of March 25, 2026 11:12 GMT +05:30 - More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)Bump2Cradle | ISO 9001: 2015 Certified | No 1 Brand by Doctors and Lactation Experts | PumpNGo Lite Silicone Wearable Breast Pump by Bump2Cradle | Soft Silicone Milk Collector | Comfortable, Low-Noise, Type-C Rechargeable | For Everyday, Value-Conscious Moms | 17, 19,21 and 24 mm Flanges | 1 Yr Warranty
₹3,699.00 (as of March 25, 2026 11:12 GMT +05:30 - More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)Oasis Baby 100% Breathable Cotton Feeding/Nursing Apron With Pocket | Adjustable Neck Strap | Tie Back | Printed Color | Breastfeeding and Multipurpose Cloth - Pack of 1
₹349.00 (as of March 25, 2026 11:12 GMT +05:30 - More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)Milton Baby Flexible Straw Sipper Bottle | 360° Drinking with No-Spill Weighted Straw | BPA-Free, Food-Grade Material |Microwave & Sterilizer Safe,Sipper water bottle for kids 9+ Month,270 ml,Sky Blue
₹375.00 (as of March 25, 2026 11:12 GMT +05:30 - More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)Pampers Happy Sleep Pant Style Baby Diapers, Small (S), 60 Count, 1 Pampers = 1 Night Sleep, with Anti Rash Shield, 4-8 Kg Diapers
₹421.00 (as of March 25, 2026 11:12 GMT +05:30 - More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)Pure Aura Baby Wipes with 99.9% Pure Water | Ultra Soft & Thick | Natural Plant-Based | Infused with Aqua & Aloe Vera | Gentle & Safe for Newborns | 72 wipes (Pack of 3)
₹281.00 (as of March 25, 2026 11:12 GMT +05:30 - More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)Teddyy Premium Baby Diapers S Size, Pant Style | Small (4-8 kg), 42 Pants | Butter Soft Feel | Anti-Rash with Aloe Vera &12 Hours Dryness Lock
₹389.00 (as of March 25, 2026 11:12 GMT +05:30 - More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)Amardeep Big Foldable Mosquito Net | Bottomless Baby Mosquito Tent with Multiple Cute Digital Prints | Insect Protection Canopy for Newborns & Toddlers | Portable & Breathable Net (Teddy_Blue)
₹350.00 (as of March 25, 2026 11:12 GMT +05:30 - More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)Mee Mee Baby Liquid Cleanser 500ml, Anti-Bacterial Kills 99.9% Germs | Cleanser for Bottles, Nipples, Accessories, Toys, Fruits & Vegetables | No Alcohol, One Drop Cleaning, Dermatologically Tested
₹198.00 (as of March 25, 2026 11:12 GMT +05:30 - More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)Auto Amazon Links: No products found.

Nice tutorial, very simple and clean
Hi Raju, You are welcome.