PHP Basic concepts
What is PHP?
- PHP stands for “PHP: Hypertext Preprocessor”. Initially it was called “personal home page”
- PHP is a opensource.PHP costs nothing, it is free to download and use
- PHP is a scripting language designed for web.
- PHP works with the web server. Ex: Apache, IIS, nginx etc which means that PHP scripts, or programs, usually run on a Web
- PHP is an HTML-embedded scripting language. Much of its syntax is borrowed from C, Java and Perl. So if you have experience with this language, you will be comfortable with php
- PHP is a one of the most popular Web programming languages. Using PHP we can build dynamic, interactive Web sites
See the below table to get the opening and closing tags of php
|Opening Tag||Closing Tag|
|<?||?> (Short Tag)|
Note: To use syntax 2, Short tag must be ‘on’ in php.ini
in php.ini file
- PHP document with an extension of .php
- PHP code is parsed on the server. This method of code execution is called “Server Side Code”.
- PHP statement end with semicolon(;)
How PHP Works?
- PHP parser finds the requested file and scan it for php code.
- When the PHP parser finds PHP code, it executes that code and send back the output to web server
- Webserver sends it to web browser and web browser displays the output on screen
Evolution Of PHP
- PHP was created by Rasmus Lerdorf way back in 1994. He released PHP to the general public in 1995, and called it PHP version 2
- In 1997, two more developers, Zeev Suraski and Andi Gutmans, rewrote most of PHP and, along with Rasmus, released PHP version 3.0 in June 1998.
- The new version, PHP 4, was launched in May 2000.
- PHP 5, released in July 2004
- It is easy to learn
- It is fast
- It is inexpensive. (Free)
- It is easy to use
- PHP is a cross – platform. It can run on many operating system.
- It is secure
- It is designed to support database
- IBM DB2
- and More
- It cotains Object-Oriented concept
Generally Comments in a programming can remind you of what you were thinking when you wrote the code.
A comment in a PHP code is used to understand the program works step by step and then Who created , Who Edited, last modified date etc.
A comment is simply text that is ignored by the PHP engine.
<?php // This is a single line comment # This is also a single line comment /* This is a multiple lines comment This is a multiple lines comment */ ?>