PHP explained in a nutshell
What is PHP and what is PHP used for
PHP is the abbreviation for "PHP: Hypertext Preprocessor", a widely used and very fast to learn open source server-side scripting language, designed specifically for web development.
In the early days of the Internet, it was very difficult to create dynamic web pages that could respond to user interactions. Static HTML web pages, which were very common in the early days, became more and more exotic. However, this quickly changed, thanks in part to the PHP scripting language.
PHP was initially rather smiled at by the international developer community and not really taken seriously. One reason for this may have been the then common name for PHP "Personal Homepage Tools". It was more likely due to the limited functionality at that time and that many programming languages already mastered object-oriented programming (OOP).
PHP has now grown up and has nothing to do with "Personal Homepage Tools", the initial name of PHP. OOP has taken hold and many good and powerful PHP-Frameworks have not only significantly improved web development with PHP over the years, but also made it more professional.
PHP market share 2023
The market share of PHP was almost 21% worldwide in 2008. In 2022, the share was around 6%. The front-runner among the most popular programming languages is currently Python, which has a market share of approx. 28%.
Nevertheless, 78% of all websites on the Internet use PHP as a server-side programming language.
What are the application areas of PHP?
Many of the most popular CMS systems rely on PHP as a programming language. Probably the best known among the PHP CMS systems is WordPress. But also Drupal, Neos and typo3 are among the best known PHP scripts worldwide. In addition to PHP-CMS systems, there are a variety of other PHP applications such as CRM systems like SugarCRM, web stores like Shopware, as well as booking systems and sales platforms. But not only online tools like a CMS system rely on PHP, also a variety of the most popular online portals, such as Flickr, Facebook and were and are developed with PHP. Ultimately, you can program almost anything with PHP.
How do I create a PHP script?
To create a PHP script, you first need a text editor or IDE (Integrated Development Environment) to write the code. An example of such a text editor would be Notepad++ (on Windows) or TextWrangler (on macOS). You can also use a full IDE like Adobe Dreamweaver, NetBeans, Eclipse or PHPStorm.
Please note that you need a web server like Apache or Nginx to run PHP scripts. If you don't have a web server, you can set up a local development server using tools like XAMPP or WAMP. It is easier if you have already booked a web package with a hoster.
Once you have chosen an editor, create a new file with the extension ".php" (e.g. "myscript.php").
<?php // This is where your PHP code goes ?>
Add the following content to your meinscript.php file.
<?php echo "hello Welt"; ?>
Call the file in your browser. You should be able to see the output "Hello World".
This is the basic structure of a PHP file. The code you write should be entered between the <?php and ?>-strings. You can also use multiple PHP tags in one file. This is often the case when you want to mix HTML and PHP.