Please wait

What is PHP?

A question as old as time itself. In this lesson, let's discover what PHP is, what you can use it for, and why it's so widely popular.

So, what exactly is PHP?

In its early days, PHP stood for "Personal Home Page," reflecting its origins as a tool for personal websites. However, as the language grew and evolved, the acronym's meaning was changed to reflect its broader capabilities as a server-side scripting language for web development. Nowadays it stands for PHP stands for "Hypertext Preprocessor."

PHP is an open-source general-purpose scripting language for developing web applications. Whoa! What does all that mean? Let's slowly unpack that definition to fully grasp PHP.

First and foremost, open source software, OSS for short, refers to code that has been freely released to the public. Anyone can study, modify, and redistribute the software. Collaborators from all over the world have voluntarily contributed their time to improving PHP. It's one of the largest open-source software projects in the world.

Where can I find the open source PHP project?

All PHP-related source code can be found at the official GitHub account. Never heard of GitHub? Not to worry, there will be an upcoming lesson covering version control with Git.

Secondly, a general-purpose language is a programming language that can be utilized to develop different kinds of programs. Originally, PHP was introduced as a language for developing server-side web applications.

As time went on, developers have discovered it can be used for other things as well, such as:

  • Command line scripting to automate tasks
  • Creating desktop applications using PHP-GTK library
  • Image processing and generation
  • Server-side scripting to handle files, emails, and other system administration tasks.

Programming languages are considered to be general purpose when they can be used to solve a wide array of problems. For all intents and purposes, this book primarily focuses on web development with PHP.

Consider other alternatives

While PHP is a fantastic language, you may want to consider other languages for specific problems. Most organizations and individuals primarily use PHP for web development.

If you're interested in developing desktop applications, try looking at Rust or C#. Want to get into mobile development? Check out Swift or Java. For data science, you can't go wrong with Python.

Lastly, PHP is considered to be a scripting language because it's interpreted. Technically, it's not wrong to call it a programming language. After all, all scripting languages are programming languages, but the reverse isn't true.

Compilers vs. Interpreters

So, what does it mean when a programming language is interpreted? If you've ever seen a movie, tv show, or documentary on computers, you've probably seen the following image:

Binary Code
Binary Code

The above example is known as binary code or machine code. Computers are only capable of understanding binary code. Binary code can be difficult to read and write. Herein lies the problem.

For this reason, programming languages were introduced for writing instructions to be executed by a machine. While programming languages are easier to read, computers don't understand the instructions we're giving them. Therefore, our code must be transformed into machine code. This process is known as compilation.

Human readable code transformed into binary code
Human readable code transformed into binary code

A compiler and an interpreter are both tools used to translate computer code into a form that a computer can execute. The main difference between the two is how they do it:

  • A compiler translates the entire source code of a program into machine code (binary) in one go and saves it as an executable file. This file can then be run as many times as needed without the need to recompile it.
  • An interpreter, on the other hand, executes the code line by line, translating each line of code into machine code and then executing it immediately. It does not generate an executable file.

Think of it this way

A compiler is like a translator who translates a book into another language, then gives you the translated book to read. An interpreter is like a translator who translates a sentence, then reads it to you immediately.

PHP is interpreted. It's safe to say that PHP is a scripting language. However, you can also call it a programming language, and no one would complain otherwise.

Take it easy!

Compilers? Interpreters? Which one is better? That's a discussion for another time that's beyond the scope of this book. There are advocates and critics for almost anything.

Luckily, it's not something you need to dive into as a beginner. PHP handles most of the complexities for you. All you need to know is that PHP is interpreted and takes care of transforming the code you've written into machine code. Having a high-level overview will suffice going forward.

PHP Web Development

The goal of this book is to teach you how to build websites using PHP. One of the interesting features of PHP is being able to generate an HTML page. This process is performed on a web server during requests. After you've generated an HTML page, you can send it back as a response. As a result, you can create unique pages for each visitor to your site.


This book assumes you have a solid grasp of HTML/CSS. If you're not familiar with either of these languages, you should check out FreeCodeCamp.

Static vs. Dynamic Pages

HTML (Hypertext Markup Language) and CSS (Cascading Style Sheets) are essential technologies for building websites, but they have some limitations and shortcomings when used on their own. Some of the key limitations of using only HTML and CSS include:

  • Static content: HTML and CSS are primarily used to create static web pages, which means that the content and layout cannot change dynamically in response to user actions or data updates.
  • Complex logic: HTML and CSS are not designed for complex logic or programming, so implementing complex functionality, such as data processing or calculations, can be challenging and time-consuming.
  • Repeated code: Without a way to automate the creation of repeating elements, such as navigation menus or footers, developers must manually create the same code multiple times, leading to longer development times and increased maintenance overhead.

Sites that deliver the same content regardless of a user's actions are considered to be static websites. These limitations of HTML and CSS highlight the need for additional technologies, such as server-side scripting languages like PHP, to create more dynamic, interactive, and functional websites.

Building websites with PHP allows for content to be different for each visitor. PHP gives developers the power to write instructions for generating a unique HTML page each time. These types of websites are known as dynamic websites.

Why should you learn PHP?

PHP is not the only language that can generate dynamic websites. So, why PHP over other languages? There are tons of benefits to learning PHP. Just to name a few:

  1. Popularity: PHP is one of the most popular server-side scripting languages, used by 77.7% of websites according to W3Tech. This means there is a great demand for PHP developers and a wealth of resources and support available for those who learn it.
  2. Beginner friendly: PHP is known for being easy to learn and use, especially for those with a background in web development. Its syntax is simple and straightforward, making it accessible to those just starting out.
  3. Cost: PHP is open-source and free to use, which makes it an accessible and cost-effective option for web development.
  4. Cross-platform support: You're not tied to a specific platform, as PHP is platform agnostic. PHP can run Windows, Linux, and Mac.
  5. Large community: With such widespread use, there is a large and supportive community of PHP developers who can provide help and resources.
  6. Scalability: PHP is designed to be scalable, which makes it a good choice for growing businesses or projects that require the ability to handle increasing amounts of traffic and data.
  7. Wide range of applications: PHP can be used to build a wide range of web applications, from simple static websites to complex e-commerce systems and content management systems.
  8. Good performance: PHP has been optimized over the years to be fast and efficient, making it a good choice for web applications that require good performance.

Companies using PHP

PHP is widely used by many organizations and businesses across different industries. Here are a few examples:

  • Facebook: One of the largest social media apps on the web uses PHP.
  • Wikipedia: The most popular online encyclopedia site is known for using PHP to deliver its content for free to visitors.
  • E-commerce: PHP is often used to build e-commerce websites, such as Magento, due to its ability to handle large amounts of data and traffic.
  • News Networks: PHP is used by many news websites, such as BBC and CNN, to power their dynamic and interactive websites.

Is PHP dying?

No, PHP is not dying. Despite the rise of new and trendy web development technologies, PHP remains one of the most widely used programming languages for web development.

In recent years, PHP has continued to evolve and improve, with the introduction of new features and capabilities, such as improved security and performance, making it a more attractive option for web developers. Additionally, the PHP community is large and active, with ongoing development and support for the language, which helps ensure its continued viability and relevance.

The job market for PHP developers is strong and continues to grow. As one of the most widely used programming languages for web development, there is a high demand for PHP developers across a variety of industries and organizations.

Did you know?

On average, the salary for a PHP developer in the United States is approximately $94,341 per year, according to Glassdoor.

According to recent surveys and reports, PHP is one of the most in-demand programming languages for web development, and there is a shortage of qualified PHP developers in the job market. This shortage of talent has led to a growing demand for PHP developers and higher salaries for those with the skills and experience needed to work with PHP.

Overall, while new technologies may emerge and some older ones may decline in popularity, PHP remains a popular and widely used technology for web development, and it's unlikely to disappear or become obsolete anytime soon.

Key Takeaways

  • PHP is short for "Hypertext Preprocessor."
  • PHP is considered to be open-source since the source code is freely viewable, modifiable, and can be redistributed.
  • A wide range of applications can be developed with PHP, from blogs to social networks to e-commerce sites.
  • PHP is interpreted.
  • PHP has a strong job market with room for more qualified developers.


Please read this before commenting