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)
AIRSEE Baby Nail Trimmer Electric Nail Drill Safe File,Baby Nail Clippers with Light & 6 Grinding Pads Polishing Shape Tools for Newborn Toddler or Adults Toes and Fingernails, Kids Nail Care (Blue)
₹259.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 Angel Baby Easy Dry Diaper Pants With 12 Hrs Absorption Medium (M) Size 72 Count, 7-12 Kgs - M (72 Pieces)
₹504.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.)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
₹671.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.)Himalaya Gentle Baby Shampoo (400 ml) | No Tears formula | Cleanses, softens and nourishes baby's hair
₹236.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.)R for Rabbit Little GrownUp Tunes Baby Potty Training Seat with Music, Soft Cushion & Ergonomic Backrest Tissue Storage for Kids | Toilet Seat Weight Up to 50 kg, 1 to 7 Years (Blue White)
₹1,249.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.)Toy Imagine Electric Baby Nail Trimmer with LED Light Baby Nail Cutter for Newborn 0–6 Months Gentle Nail Filer with 6 Filer Heads Adjustable Speed Quiet Baby Grooming Kit for Kids Multi Colour
₹249.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.)R for Rabbit XL Size Premium Feather Diaper for Baby 12 to 17 kgs (46 Pack Offer)
Now retrieving the price.
(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.)