Introduction to PHP
What is PHP?
PHP is an open source scripting language used on the backend of software development. PHP is an acronym for “PHP: Hypertext Preprocessor”. In 1994, the first version of PHP was created by Rasmus Lerdorf. PHP files can hold text, HTML, JavaScript, CSS and PHP code. PHP files have the extension “.php”. PHP can be used to create, open, read, write, delete, and close files on the server. Form data can be collected with PHP and cookies can be sent/received. PHP is used to add to, delete or modify your database. PHP is integrated with many popular databases like MYSQL, POSTgreSQL, Sybase, Informix, and Oracle. PHP is also used to control user access and encrypt data. 8.0.2 is the newest version of PHP released February 2021. It contains many new features and optimizations like named arguments, union types, nullsafe operator and constructor property promotion to name a few.
Basic Syntax
The PHP script is first implemented on the server, and then the HTML result is sent back to the browser. The PHP script can be located anywhere in the document. The PHP script begins with <?php and ends with ?>. A PHP file generally contains HTML tags and PHP scripting code. In the following code, the function “echo” is a built- in PHP function that is used to output “Welcome to my World!”
PHP is not case sensitive. So when using keywords (ex. If, else, while, echo, etc.), functions, classes, and user-defined functions they are not case-sensitive. In the code below, the three different echo statements are all equal and legal in PHP.
Code written in PHP must be included inside one of the following markup tags that are recognized by the PHP Parser.