PHP for Web Development

by Vincy. Last modified on June 2nd, 2021.

PHP is the most popular language used for web development. Unarguably the winner in terms of popularity. If you are planning to jump into building modern websites, choose PHP without even thinking for a second.

It is the number one programming language when it comes to web development and there are reasons to it. I will detail them in this article and give you an introduction for PHP.

History

PHP was created by Rasmus Lerdorf in 1994.

I recommend you to watch this video, it is a talk by Rasmus Lerdorf on PHPday 2019 commemorating the 25 years of PHP. Yes it is been more than 25 years now, PHP is live and rocking.

The first release of PHP was done in June 1995. It was then called as “Personal Home Page (PHP) Tools”. The initial PHP was as set of CGI binaries written in C. Rasmus Lerdorf wrote it to track visits to his online resume.

Rasmus Lerdorf PHP Creator

Image of Rasmus Lerdorf by William Stadtwald Demchick via Wikimedia Commons.

Now the PHP stands for the recursive initialism PHP: Hypertext Preprocessor. You can read the official PHP language reference to know in-depth about core language constructs.

PHP Logo

ElePHPant is the mascot of PHP. Adorable isn’t it?

PHP Versions

Versions Key Features Description
PHP/FI (1995)
  • Form handling
Perl/CGI script (PHP 1.0) introduced by Rasmus Lerdorf. The Expansion is Personal Home Page / Form Interpreter.
PHP/FI2 (1997)
  • Data conversion
  • Form data export
With slight modifications in Form Interpreter(PHP 2.0) to handle form entries.
PHP  3 – (1998)
  • PHP core is rewritten
  • PHP parser is rewritten.
  • Zend Engine is incorporated.
Language core was changed by Zeev Suraski and Andi Gutmans and PHP refers to PHP: Hypertext Preprocessor.
PHP 4 – (2000)
  • Object-Oriented support
  • External resource handling
  • Security
  • RegEx handling
With features for supporting enterprise-oriented applications.
PHP 5 – (2004)
  • Improved object model
  • PDO Support
  • Exception handling
  • XML support
PHP core was almost stabilized with this release. Later 5.X releases have slight enhancement.
PHP 7 – (2016)
  • Improved performance (twice as that of 5.6)
  • Reduced memory usage
  • The null coalescing operator (??)
  • Return and Scalar Type Declarations
  • Anonymous Classes
  • Zero cost asserts
PHP 6.0 was skipped and PHP 7 was released. There was no clear official mention on why version 6 was skipped and there are many theories floating around. You can get more information on this by going through the linked HN discussion.
PHP 7.4

28 Nov 2019

  • Typed Properties 2.0
  • Preloading
  • Null Coalescing Assignment Operator
  • Improve openssl_random_pseudo_bytes
  • Weak References
  • New custom object serialization mechanism
  • Password Hash Registry
Note: This list presents only the major and the latest release.

The feature list is a high level summary and not comprehensive. Please refer the official release notes for the complete list.

Why PHP?

I posted an article in a FB group of developers on how to do web development using PHP. Among the volume of comments, there was a question that intrigued me.

Better say Why (PHP) than How!

When I started web development a decade ago, PHP was my natural choice. I never thought about why PHP!

Java is on the helm, Python is growing rapidly, Golang is there, so many choices around. Yes the commenter was correct, I have to explain Why PHP.

  1. I am not saying PHP is great for enterprise applications or scientific programming or of that sort. PHP does not competes with Java. Java is great in write once and run anywhere. PHP is great for web development: building websites.
  2. PHP is free. Truly free.
  3. Easy to learn and on-boarding is quick. Just with a couple of days effort, you can build a basic website. You can start quick and ease into advanced stuff gradually. From day one, you will get things done.
  4. Library support is enormous. Core libraries and public free library support is unbelievable. 25 years of existence gives this.
  5. Small code footprint. One example, mail(…), you can send an email in one line. It comes in the core. Another example is support for JSON, it is too good to ignore. Get simple things done in a simple way.
  6. Availability of mature frameworks. You have got lots of choices. Laravel, CodeIgniter, Symfony to name a few. Hope you have heard about WordPress, an excellent blogging and multi-purpose platform. Almost any blog on the Internet runs on WordPress / PHP.
  7. Support for hosting is enormous. You buy any basic hosting from any hosting provider, there will be support for PHP. You can assume it. That’s what the popularity gives!
  8. Flexible, there are n number of ways to get things done. It does not force semantics on you.
  9. Documentation is good. PHP official documentation is really good. Added to that, you can find so much online material, example code, tutorial, video tutorial, blogs, etc.
  10. Community, community, community. PHP has got an experienced vibrant community. I was never stuck on a programming issue for long. Abundant resource and online community support is available.

Unique features of PHP

To witness the execution of PHP checkout version PHP 7+. You will experience breakneck speed. More than highlighting features like these, I wish to highlight some unique features of PHP.

Robust, secure, cross platform, blah blah blah, these are features that every language in the Earth has. Let’s see something unique about PHP.

S.No Features
1. Loosely Typed Language – PHP supports variable usage without declaring its data type. It will be taken at the time of the execution based on the type of data it has on its value.
2. PHP Array – Arrays in PHP are special datatypes and very flexible in the way you can handle them.
3. variable variables – PHP allows changing the variable name dynamically by using variable variables.
4. Real-Time Access Monitoring – PHP provides access logging by creating the summary of recent accesses for the user.
5. Magic Method – PHP has built in methods starts with __ (double underscore). These methods can’t be called directly. Rather, it will be called on the event basis. For example, __clone() will be called, when the clone keyword is used.
6. Error Reporting –  It has some predefined error reporting constants to generate a warning or error notice. For example, when E_STRICT is enabled, a warning about deprecated methods will be generated.
7. Extended Regular Expression – PHP provides REGEX methods with extensive parsing and pattern matching mechanism with remarkable speed.
8. nowdocs and heredocs String –  PHP provides the nowdocs and heredocs properties are used to delimit some block of context.  nowdocs and heredocs are same except the context in the heredocs allow variable parsing.
9. Traits – PHP is a single inheritance language. The traits concept is used to cover inheritance limitation and support inheritance at multiple levels.

Leave a Reply

Your email address will not be published. Required fields are marked *

↑ Back to Top

Share this page