What is PHP?
PHP stands for "PHP: Hypertext Preprocessor". Initially it was called "personal home page"PHP is an opensource.PHP cost 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
Syntax
See the below table to get the opening and closing tags of phpOpening Tag | Closing Tag |
---|---|
<?php | ?> |
<? | ?> (Short Tag) |
<script language='php'> | </script> |
PHP File
PHP file contains HTML, CSS, javascript, user text, and php code
PHP code is parsed on the server. This method of code execution is called "Server Side Code".
Note: When code is executed in the browser We call that "Client-Side Code".Ex. Javascript
PHP statement ends with a semicolon(;)
PHP Works
When the PHP parser finds PHP code, it executes that code and sends back the output to a web server
Webserver sends it to a web browser and web browser displays the output on the screen
Evolution Of PHP
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
PHP Advantages
It is fast
It is inexpensive. (Free)
It is easy to use
PHP is cross-platform. It can run on many operating systems. Linux
Mac
Windows
Unix
Solaris
It is secure
It is designed to support databases-SQL
Mysql
Oracle
PostgreSQL
SQLite
IBM DB2
and More
It contains an Object-Oriented concept
PHP Comments
Generally, Comments in 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 */ ?>