PHP is a server-side scripting language that is also an interpreted language. It is basically used for developing software applications that have dynamic content and require constant interactions with databases. It is an open-source language making it one of the most sought platforms for developers and companies.
Features and Advantages
The performance of the scripts written in PHP is much better than those written in other languages like JSP and ASP.
Being open source, we can develop and maintain our applications without incurring any cost.
PHP is a platform-independent language, i.e., it can run on any OS without any problem
PHP code can also be embedded into HTML tags and scripts.
PHP Tags and the parsing engine
The code written in the PHP script is executed using the PHP parsing engine. The PHP parsing engine needs a way to differentiate the PHP code from other elements in the page.
<% [code here] %>
Commenting in PHP code:
A comment is a piece of code that is not executed by the compiler rather it is there just for the human reader to read. Comments in general are used to explain the code better and improve the readability of the code.
There are multiple types of comments:
Single Line Comments
Single-line comments are used to provide short explanations or points related to the code.
<? //This is a comment ?>
Multiline comments are used to provide more detailed explanations about the code whenever necessary. This system of commenting is same as the system of commenting in C
We can also run php scripts from our command prompt by referring to the file the php script is stored in
Let us assume there is a php file with the name test.php which holds the script
Echo “Hello world!!”; ?>
We run this script in the command line in the following way $php test.php It will produce the result Hello world!