3 ms·
I only started using PHP this year (legacy project at work), and I also strongly dislike PHP. What I dislike about (server-side) PHP: - Ugly syntax. For the l
by bendmorris 12y ago
I only started using PHP this year (legacy project at work), and I also strongly dislike PHP.
What I dislike about (server-side) PHP:
- Ugly syntax. For the languages with algol-inspired syntax, I feel PHP has the most oddities: "$", "=>", foreach (collection as iterator), etc.
- Inconsistency in the standard library. Naming - does the function I want have an underscore or not? isset doesn't, is_array does. The ordering of function arguments is also often different from one function to the next. IDE or php.net can help you with this, but when you're in a productive flow, this is an unnecessary impediment.
- Doing OOP in PHP, you get a lot of the verbosity of a language like Java without the type safety or standard library features. Nested arrays are common because there is a distinct lack of useful data structures in the language. Arrays are used as a mishmash of array/linked list/hash map because the language doesn't differentiate, leading to subtle bugs.
- As a dynamic language, I feel it compares unfavorably to Python in just about every meaningful way. Much more verbose than Python (list, generator and dictionary comprehensions, for example, cut down on a lot of boilerplate in Python.) Less powerful metaprogramming (in Python you can override __setattr__ to execute code whenever attributes are set; in PHP you can define __set magic attribute which doesn't work on public attributes, limiting its usefulness.) The standard library is less useful. It's not as simple to package and deploy.
- Modern features are starting to creep into in the language, but I feel it's too little too late. We recently had to upgrade a server to PHP 5.5 because I sold decision makers that using generators to stream data would result in much more maintainable code than shoehorning what we were trying to do into iterators. For a moderately large company with enough legacy, upgrading the PHP version can be an ordeal. Python has featured generators since 2003.
- I do feel that quality of candidates is an important consideration. A lot of people cut their teeth on "HTML, CSS and PHP" before moving up to "real" programming languages. The rate of applicants who don't have strong programming ability will be higher for PHP than for comparable languages.
I've been using PHP professionally for almost a year and I would never use it for a project unless it was already in use.