How it works
PHP runs on the server: when a page is requested, PHP code builds the HTML (or JSON) and sends it back. Each request starts fresh and shares nothing with the last, which keeps hosting simple and stops one broken page from taking down the rest. It began in 1994 as a few tools for a personal home page and grew into a full language.
Modern PHP is far from its messy reputation. Versions 7 and 8 brought large speed gains, type declarations, enums, attributes and a JIT compiler, and Composer manages packages. Laravel and Symfony are the main frameworks, and WordPress, Drupal, WooCommerce and Magento are all written in PHP.
PHP pros and cons
Pros
- Runs on nearly every host, including cheap shared hosting
- Simple deployment: upload the files and they run
- Mature frameworks (Laravel, Symfony) and the WordPress ecosystem
- Much faster and stricter than its old reputation suggests
Cons
- Inconsistent function names and old habits linger in the standard library
- Plenty of outdated, insecure tutorials and plugins still circulate
- Live features such as WebSockets need extra tools or services
When to use PHP
Pick it when
- WordPress sites, plugins and WooCommerce shops
- Laravel apps, where one framework covers most of the backend
- Budget hosting where PHP is the main option
Skip it when
- A team that already writes JavaScript or Python on the server
- Apps built around live, long-lived connections
PHP pricing
Related terms
More in Programming languages
Web