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 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)
(3 Meter) Edge Protector, Baby Proofing Edge Protector Strip for Baby, Child Proof Table Edge Protectors Guards Safety Bumper Cover for Furniture Desk Crib Gate Bed Wall Soft Silicone
₹299.00 (as of July 1, 2025 20:03 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)
₹345.00 (as of July 1, 2025 20:03 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.)Owme Unicorn Night Lights for Girls Bedroom,16 Colors Cute Night Light for Kids, Led Rechargeable Unicorn Lamp, Unicorns Gifts for Girls Night Lamp, Silicone Night Light Kids Cute - Multicolor
₹299.00 (as of July 1, 2025 20:03 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.)Novo Baby 12-Piece Baby Safety Electric Socket Plug Guards | Baby Proofing Switch Board Cover for Kids Safety with Easy Removal Pin (Pack of 12, White)
₹149.00 (as of July 1, 2025 20:03 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.)CERELAC Baby Food Cereal | No Refined Sugar | Rice Vegetables for 8 to 24 Months Baby | Omega 3 Iron Protein Calcium Vitamin D for Babies | Instant Cereal | 300g
₹310.00 (as of July 1, 2025 20:03 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 Extra Moisturizing Baby Wash 400ml | No tears formula |with Olive Oil, Aloe Vera & Milk | Cleanses and moisturizes baby’s skin
₹200.00 (as of July 1, 2025 20:03 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 Detergent 1 L | Ph balanced, Free from Harsh Chemicals, Safe for mother's hands & baby's skin | Anti-Bacterial, Removes Stains & Odor with One Drop, Hypoallergenic
₹249.00 (as of July 1, 2025 20:03 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.)AVENT Philips Natural Response Baby Feeding Bottle - 125Ml Baby Milk Bottle for Newborns and Up, Bpa Free, 0+ Months (Model Scy900/01)
₹493.00 (as of July 1, 2025 20:03 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.)ROMINO Gas Saver Stand, Gas Stove Burner Stand, Gas Flame Protector From Wind Burner Cover Protector Windproof Energy Saving, Metal Body
₹465.00 (as of July 1, 2025 20:03 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 Comfy Pants Baby Diaper, Medium (M) Size (7-12 Kgs), Pack of 102
Now retrieving the price.
(as of July 1, 2025 20:03 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.)