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.

Why use PHP?
PHP can be run across many different platform applications like Windows, Linux, Unix, Mac OS X and a number of other operating systems. PHP is compatible with almost all servers. It is open-source and free for all to use at https://php.net. This allows for a large and active international community that uses PHP. PHP was partially developed as an object-oriented language, so the code is reusable as possible. PHP was created to program web applications through built-in GET and POST functions, in addition to URL and HTML script functionality. PHP’s server side offers great versatility. PHP supports backend servers including Netscape, Apache, Microsoft IIS, iPlanet, Caudium, Xitami, and Tornado. PHP is also supported by 20 databases. PHP’s fast performance enables quick turnaround times with the database. Since PHP was initially developed for creating dynamic websites, PHP’s scripts are easily embedded into HTML files. This makes it easier for developers to convert static website code into dynamic websites. Websites that use PHP are Facebook, Wikipedia, Tumblr, Slack, MailChimp and Etsy.