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)
StarAndDaisy Baby Carrier for 0 to 3 Year Baby, 4-in-1 Baby Carrying Bag with Wide Ergonomic Hip Seat, Adjustable Waist Belt, Padded Shoulder Straps, Storage Pocket & Bottle Holder, Dark Grey
Now retrieving the price.
(as of November 10, 2026 01:36 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.)Mother Sparsh Milky Soft Head to Toe Baby Wash & Baby Shampoo-400ml with Milk Protein & Shea Butter | Ph balanced & Paraben free 2 in 1 Moisturizing Natural Baby Body Wash & Shampoo
₹248.00 (as of November 10, 2026 01:36 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 Complete Skin Comfort Pants, (XL) 56 Count, Anti-rash blanket, Lotion with Vitamin E & Aloe Vera, Extra Large size baby diapers, 12-17kg
₹966.00 (as of November 10, 2026 01:36 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.)CHRUTRA Latest Automatic Breast Pump Efficient Electric Milk Pump for Breastfeeding Mothers Comfortable, Portable, Quiet Suction Pump Ideal Postpartum Nursing Solution
₹1,299.00 (as of November 10, 2026 01:36 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.)Philips Avent Ultra Air Pacifier, 0-6 Months | Aids Natural Oral Development | Oral Health Foundation Accredited |Food-Grade Silicone Nipple | Extra-Large Airholes | Plant-Based, BPA Free | SCF087/02
₹625.00 (as of November 10, 2026 01:36 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.)KORX Foldable Baby Mosquito Net for Bed, 0-36 Months (White Grey) | Pop-Up Portable Design, Ruffled Border, Bottomless Net, 0-36 Months, For Newborns & Infants
₹398.00 (as of November 10, 2026 01:36 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.)Himalaya Soft & Gentle Baby Wipes |72 Wipes x B3 G1 Free - 288 Wipes | With Licorice & Aloe Vera | Gently cleanses & Helps prevent the cause of Nappy Rash | With the Goodness of Himalaya Baby lotion | Extra Soft | Skin-Friendly pH
₹229.00 (as of November 10, 2026 01:36 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.)R for Rabbit Pant Style Feather Diaper XL Size for Baby 12 to 17 kgs 46 Units (46 Count, Pack Of 1)
₹646.00 (as of November 10, 2026 01:36 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.)Pudoro Little Dreams Baby Pillow with Adjustable Side Rollers | Pack of 1 - White
₹299.00 (as of November 10, 2026 01:36 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.)1st Step Socket Protectors for Baby & Kids | Pack Of 12 (6 A X 9 pcs And 16 A X 3 pcs) | Child Safety Proof Electrical Socket Covers for Switch Board| Easy to Install & Remove | Dummy Plug Cover Guards for Kids Safety |Baby Proofing Safety Accessories
Now retrieving the price.
(as of November 10, 2026 01:36 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.)
Nice tutorial, very simple and clean
Hi Raju, You are welcome.