When I started web development 5 years 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.
- I am not saying PHP is great for enterprise applications or scientific programming or of that sort. PHP does not compete with Java. Java is great in write once and runs anywhere. PHP is great for web development: building websites.
- PHP is free. Truly free.
- Easy to learn and on-boarding is quick. Just with a couple of days’ effort, you can build a basic website. You can start quickly and ease into advanced stuff gradually. From day one, you will get things done.
- Library support is enormous. Core libraries and public free library support is unbelievable. 25 years of existence gives this.
- 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.
- 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.
- 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!
- Flexible, there is n number of ways to get things done. It does not force semantics on you.
- 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.
- Community, community, community. PHP has got an experienced vibrant community. I was never stuck on a programming issue for long. Abundant resources and online community support are 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 on the Earth has. Let’s see something unique about PHP.
|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 data types 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 a summary of recent accesses for the user.|
|5.||Magic Method – PHP has built in methods start with __ (double underscore). These methods can’t be called directly. Rather, it will be called on an 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.||now docs and heredocs String – PHP provides the now docs and heredocs properties are used to delimit some block of context. now docs and heredocs are the same except the context in the heredocs allows variable parsing.|
|9.||Traits – PHP is a single inheritance language. The traits concept is used to cover inheritance limitations and support inheritance at multiple levels.|