PHP (short for Hypertext Preprocessor) is an Open-Source scripting language which is mainly used to generate HTML-code when developing websites.
Example:
<?php
$variable = "Testvariable";
echo "This variable contains following text: " . $variable;
?>
Result:
This variable contains following text: Testvariable
In this example a basic variable is being defined and directly after that being outputted via “echo” after the text “This variable contains following text: “.
Due to the fact that PHP is a scripting language the content of the PHP file is being processed on every request. In contrast Java or C need to be “compiled” into machine code before it can be executed.
PHP offers quite a few functionalities out of the box – for example:
- Database operations (MySQL, PostgreSQL, SQLite etc.)
- Filesystem operations (Create/Edit/Delete folders or files etc.)
- String manipulation (Create/Edit/Delete text etc.)
- XML operations (Create/Edit/Delete XML data structures etc.)
- and much more
These are just some basic which you can basically can find in any “Default PHP” installation. But PHP has so called “PHP modules” to extend the functionality PHP offers.
Popular PHP modules are:
- XDebug (Extended Debug functionality)
- OPCache (Saves precompiled bytecode from PHP in RAM instead of recompiling it on every request => performance boost)
- MBString (Adds the ability to handle “MultiByte Strings” in PHP – e.g. Emoji Icons)
- GD (Image editing in PHP like rotating or converting)
- SOAP (A special, XML like data structure)
- and much more
How PHP can be used via web servers or via the CLI can be seen in “CLI vs WebServer Integration“.
Due to the fact that PHP is always evolving I have gather the most important changes of PHP 7.1, 7.2 and 7.3 HERE.
Sources:
PHP: What is PHP – https://www.php.net/manual/de/intro-whatis.php