PHP is a server-side scripting language designed to be used for web purposes.
Originally PHP was short for “Personal Home Page” but over time it evolved to include that in its recursive current expansion “PHP: Hypertext Preprocessor”.
Server-side scripting languages interpret scripts on the server side rather than client-side (like JavaScript).
Doing so provides a customized interface for each user and adds functionality beyond what HTML can offer.
Scripting languages are programming languages that are interpreted rather than needing to be compiled before execution.
What problem does it solve?
PHP allows for interactive features not possible with HTML. In its earliest days it was used for hit counters and guest books.
Now developers use PHP to create web forms, forums, complex shopping carts, and other features that encourage two-way interaction with visitors.
Benefits of PHP
- Open Source
- Inexpensive hosting and setup
- Cross-Platform
- Client applications don’t need PHP installed
- Lots of free libraries and packages available for use
Strengths of PHP
PHP is simple to learn and write. Anyone who knows HTML can quickly pick it up, and the two can be used interchangeably.
Since PHP is a dynamically typed language, it’s also highly flexible. There are no rules on how to build features, so developers have plenty of room for innovation.
The tool’s flexibility goes beyond ease of use, too. PHP can handle a wide range of data types.
It integrates with all the popular databases including MySQL, Postgres, Oracle, and MS SQL Server.
PHP is well-maintained and supported by a huge community. As such it’s likely to stay more current than other mature tools.
One side benefit of its popularity is that finding skilled developers is easy.
Programmer productivity stays high with PHP.
It operates at a request level with a full state reset for each request, so programmers have a more streamlined development experience. The structure makes debugging easier.
Weaknesses of PHP
PHP’s main strength - flexibility - is also its weakness. It can be a little too forgiving of errors.
With no strict rules, inexperienced programmers have the freedom to create some very bad solutions to simple problems.
Bad packages that got popular in the community are still reused when developers are trying something new or rushed for time. Some of these mistakes lead to security risks.
As a mature tool PHP has some legacy baggage. There are lots of internal consistencies, especially surrounding references and values.
This is mostly due to updates that add features that clash with earlier features.
PHP is an interpreted language, which can reduce speed.
PHP 7 increased performance over previous versions by a significant amount while maintaining most language compatibility.
The changes didn’t affect the learning curve or existing applications much while improving performance. Still, it executes more slowly than compiled languages.
Scaling and maintaining PHP is a complicated endeavor.
Context matters a great deal in dynamically typed languages, so tracking down errors gets harder the larger an application grows.
Experienced PHP developers can mitigate this problem y planning for scalability, but there’s only so much they can do to reduce maintenance issues down the road.
Comparison
PHP is often compared to Java, but a better comparison is Python. Both are mature, open-source languages with large communities.
They’re versatile and easy to learn. However, the two have different scales and purposes.
PHP is a scripting language mainly meant for web development while Python is powerful general programming language with many other uses.
Python has cleaner syntax and is overall more secure than PHP. It’s better for graphics, engineering, and science.
PHP does edge Python out as far as performance for web development purposes, though.
Real-life Application
Current users of PHP include Joomla, Wikipedia, Yahoo!, Tumblr, and Slack.
Facebook liked it so much that, instead of migrating away as they grew, they created a custom PHP-derived language called Hack to let them continue using it at scale.
Facebook might be the largest single company that features PHP, but WordPress is a major driver of its continued usage.
It’s written using PHP as the scripting language. While the average customer doesn’t need to know PHP to set up a site, anyone who makes WordPress themes or plugins needs at least a basic understanding of the language.
WordPress powers nearly a third of all published sites and is the fastest growing CMS available, so PHP can be found in most corners of the internet.
Conclusion
80% of web uses PHP. It’s one of the more reliable tools for web development.
PHP admittedly has a bad reputation with some developers because of scaling and performance issues with past versions.
PHP 7 arrested the falling popularity by fixing several issues, increasing performance closer to that of similar scripting languages. It remains to be seen if this can win skeptical developers back.
On a practical level, there are many large and well-regarded applications of PHP that perform well with loss of traffic. Facebook still supports it strongly.
Even Disney uses PHP via WordPress. Given those facts, PHP will likely stay in use for the foreseeable future.
Are you trying to improve your digital strategy, but find yourself held back by limited understanding of your company’s stack? Concepta’s veteran web developers can help you determine what you have, what you need, and where to focus next.