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.

Modern websites are no longer developed with one programming language, sometimes a whole handful of programming languages are used. For the server-side execution, for example, PHP and as a front-end language JavaScript, HTML and CSS. Whoever deals with PHP development cannot avoid database systems. An early companion is the mySQL database, which in our view may also have contributed to the success of PHP.

PHP market share 2024

Today, PHP is here to stay, which may be due to the fact that PHP is very easy to learn and you can get very good results in a very short time. Although, if you look at the statistics for the 10 most popular programming languages, PHP tends to lose ground, ranking 6th alongside Java, Python and JavaScript among the most popular programming languages worldwide.

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.

Author of the article:

Publish a tutorial

Share your knowledge with other developers worldwide

Share your knowledge with other developers worldwide

You are a professional in your field and want to share your knowledge, then sign up now and share it with our PHP community

learn more

Publish a tutorial

Einfaches News-Script

Das hier ist ein kleines Tutorial, um zu zeigen wie so ein News-Script aussehen kann. Im Grunde ist es nichts anderes als ein Gästebuch, in welches jedoch nur der Webmaster (oder sonstige authorisierte Personen) etwas eintragen kann. Natürlich kann man ...

pik

Autor : pik
Category: PHP-Tutorials

phpinfo() shows nothing

Today I want to show you how to output the phpinfo(). ...

Webmasterfreaky

Autor : Webmasterfreaky
Category: PHP-Tutorials

Webserver, Sicherheit ist realisierbar

Diese Facharbeit beschäftigt sich mit dem Herzstück eines Netzwerkes, dem Webserver. ...

me1@

Autor : me1@
Category: Linux & Server Tutorials