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 .phpComment 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 commentVariable 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)
Pampers Premium Care Pant Style Baby Diapers | Medium (M size) | 54 Count | Voted India's Softest | All-in-1 with 360 Cottony Softness Diapers | 7-12kg
₹780.00 (as of March 19, 2026 09:38 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 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)
₹331.00 (as of March 19, 2026 09:38 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.)Little's Premium Baby Diapers XL Size (Extra Large) Pants Style | 12-17 kg | 54 Count | Super Jumbo FluffySoft Baby Diaper with Leakage Guard, Wetness Indicator & 12 Hours Absorption
₹472.00 (as of March 19, 2026 09:38 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.)Mamypoko pants All night absorbPant Style Baby Diapers Large Size(L), 40 Count, Ideal for 9-14Kgs1 DiaperWider Crisscross SheetGentle Coco Care12hr Leakage ProtectionPrevents Heaviness.
₹410.00 (as of March 19, 2026 09:38 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.)Kidbea Steel Baby Feeding Bottle 250ml | Baby Milk Bottle with Advanced Anti Colic Valve, BPA Free, Soft Silicone Nipple, Wide Neck for Newborn & Infant Kids
₹299.00 (as of March 19, 2026 09:38 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.)Mylo Baby AirPrime Premium Diaper Pants Small (S) Size (4–8 kgs) (26 Count) Leak Proof | Ultra-Thin & Breathable | Up to 12 Hours Protection | No Rashes
₹499.00 (as of March 19, 2026 09:38 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 Spout Sipper,No-Spill Design,BPA-Free,Food-Grade Material,Microwave-Sterilizer Safe,Easy-Grip,Smooth Open-Close Action,Lightweight,Ideal sipper water bottle for kids 12+Month, 420 ml,Green
₹449.00 (as of March 19, 2026 09:38 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.)Silverflix Baby Disposable Diaper Bags with Dispenser Case – 7 Set (6 Rolls + Holder), Leak-Proof & Odor Control Nappy Disposal Waste Bags for Baby Diapers, Sanitary Pads, Pet Poop, Travel Friendly
₹199.00 (as of March 19, 2026 09:38 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 19, 2026 09:38 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 Easy Baby M Size Diaper Pant Style | 74 Count (Medium) | 7–12 kg (Pack of 1) | Long Protection Hours | Anti-Bacterial | Airy Breathable Fit | Rapid Soaker Channels with Wetness Indicator
₹464.00 (as of March 19, 2026 09:38 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.)ZEBRONICS Blanc Slim Wireless Mouse with Rechargeable Battery, BT + 2.4GHz, 4 Buttons, 800/1200/1600 DPI, Silent Operation, Multicolor LED Lights
₹399.00 (as of March 19, 2026 15:26 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.)XIAOMI Pad 8 Nano Texture Display Creator's Edition with Focus Pen Pro | Snapdragon 8s Gen 4 |11.2" 3.2K | 12GB, 256GB | Ultra Slim Metal Design | 9200mAh Battery | HyperAI | Wi-Fi 7 | Graphite Grey
Now retrieving the price.
(as of March 19, 2026 15:26 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.)