What is PHP?
The name PHP stands for PHP: Hypertext Preprocessor, it originally stood for "Personal Home Page". It was created by Rasmus Lerdorf in 1995 to make more dynamic and interactive websites. Since then it evolved a lot with every new release, being supported by a large community. The current major new release version of PHP is 7.
PHP is an open source programming language (everyone is free to use it) that is used on server-side (it needs to be run by a server application). It's particularly used in building web applications. PHP code can be embedded with HTML (will get more into this later).
Acording to W3Techs' statistics, in 2019, 78.9 % of all the websites in the world that had a known server-side programming language were using PHP.
The mascot of PHP (used in logo) is represented by a blue elephant ("elePHPant"), for the fact that its shape resembles the languages' name "PHP".
How to setup a PHP file
To tell to the server that our code from within a file represents PHP code, we need to include the code between <?php and ?>.
<?php // ... here we put the PHP code ?>
A PHP file must have the .php extension at the ending of it's name, having the full name like "contact_us.php" or "homepage.php" .
When writing PHP code we may want to add some explanation lines or just add some short descriptions. This is a thing that it's quite encouraged, this way you or somebody else will understand better and easier the purpose of your code.
The server will not use the comments, it will treat them as they don't exist among the code.
To add a single line of comment use // at the beginning of the line.
<?php //This is a single line of comment
If you need to add longer comments you can use the delimeters /*, that marks the start, and */ that marks the end of the comment.
<?php /* This is the first line here is the second line and here is the last line */
How do you add comments in PHP?