- PHP is still the best at generating web pages.
- PHP offers all the tools needed to build strong applications (PHPUnit, xDebug, XHProf, ...)
- PHP is not as bad as people like to say.
And I could go on for hours on why I (and others probably) stick to PHP.
Best for generating web pages is a meaningless metric, and...
To be honest my main issue with PHP relates to the defense that "PHP is not as bad as people like to say.". I mean, really - its true. PHP5 is significantly better language than the previous versions, and people always over-exaggerate how bad it is. The problem is that PHP is not a good language.
Whenever I develop in Python/Ruby I actually enjoy the 'feel' of the language, and I'm often impressed by the power it has to do really complicated things in simple concise instructions. Most of the time when I'm working with PHP the feeling is very different. I can perform the same operations but generally theres far more cruft, and a couple manual lookups to see why functions behave differently when hashes ("arrays") have numeric indices (I'm looking at you array_merge!)
What? No. Do you have any proof of this? I have yet to come across a "normal" shared/dedicated hosting service that doesn't support PHP. That is an insane statement.
In terms of actually finding website hosting for an application?
Saying PHP is the hardest was likely an over-exagguration, but the market for Heroku PaaS style hosting is growing massively and its Ruby runs on it very easily.
Its not hard (at all) to find hosting for either, the only reason in my mind PHP is harder is because of how beautifully PaaS works and that its free for small applications (good luck finding a reasonable free php host -- I know they exist but you'll have to dig through a whole lot of crud first)
Although, it is way, way cheaper.
If you like Heroku, check out PhpFog.com or Orchestra.io. It's like magic too.
"PHP is not a good language" what is a good language? To take your example, I do enjoy the feel of PHP, it feels natural to read to me, and after years of using it I rarely have to check the documentation for function behavior (such as array_merge...).
This should not be something that takes years. I rarely have to check the documentation for similar Ruby functions after using it for only a couple months. After using PHP for 8 months straight, all day every day, I still had to look up almost every standard library function call - even if I thought I knew how it worked, I still had to check because the pervasive inconsistencies in the standard library ensured that I could never be confident in my guess.
(This is only the tip of the iceberg for why I don't like PHP and don't recommend people use it, for other reasons see: fatal errors vs. exceptions, the strange implementation of OOP (late static binding? isn't that an oxymoron?), and the numerous failing test cases / bugs that reveal themselves in every new release.)
huh? Every VPS and shared hosting provider out there has PHP hosting.
"Whenever I develop in Python/Ruby I actually enjoy the 'feel' of the language,"
I use a language not because of its feel, but about what I can create with it. PHP is by far the easiest, most supported, and has a ton of real-world examples of sites getting millions of hits/day using it successfully.
"I can perform the same operations but generally theres far more cruft, and a couple manual lookups to see why functions behave differently when hashes ("arrays") have numeric indices (I'm looking at you array_merge!)"
I agree with you there. My one main gripe with PHP is inconsistent syntax/usage. However, I dislike frameworks like RoR because it is too high-level. I feel like I don't have enough power to do some customizations and when I do need to do them in something like RoR, I have to add hacks onto it.
I realized I could just as well be using Erlang, as far as shared hosting support is concerned.
Now I'm thinking about switching to Python or Node. Or even Haskell.
- PHP is still the best at generating web pages. What?!
- PHP offers all the tools needed to build strong applications (PHPUnit, xDebug, XHProf, ...) Testing - PHP is probably the worst language I've ever written tests in, it is horrible compared to Ruby, Java, Node, Objective-C, C#. Other languages provider far better testing tools and debuggers. xDebug is horrible to setup compared to other languages where the debugger just works.
- PHP is not as bad as people like to say. I agree with this point for sure, PHP 5.3 copes with most normal object oriented stuff, but so do all the other good languages for writing web applications, only the other languages have fantastic implementations, not "not as bad as people think" implementations. If this is one of your main points in recommending a language, that is shameful.
I use Ruby sometimes, it sure is a lovely language. That doesn't detract from the fact that PHP is still the most largely used web programming language around.
I do development work in, consult about, get paid to write about and sell commercial products using... PHP. It has the biggest potential market for me so it has the most potential customers, the most potential readers and the most potential work.
Besides, even if you personally decide to switch to Ruby the PHP community will still exist and still suffer the same problems. Those need to be fixed, no matter what.
Please do not detract from a single topic with a random "PHP v Ruby" thread. I'm not surprised but I am disappointed.
If you really want to see something a bit different you'd have to look at npm and node which really buck the system by installing everything locally by default. The ability for different versions of the same dependency at different points in the tree is also pretty amazing. This is the direction that composer is going with it's included autoloader and similar package syntax.
If anything composer may go even one step farther by forcing you to document your dependencies in a manifest instead of allowing you to specify an individual installation via the install command.
Node for example is lots of fun, but most of the libraries come complete with their bugs and lack of maturity. These are exciting things to work with, but not always best bang for the buck if you're aiming at being productive.
As for Ruby itself getting faster, well guess what PHP itself is getting faster all the time too [1]. You left it behind and it's still evolving without you. Shocker.
Luckily, my colleagues at the day job are supportive and through them, I'm slowly getting my head round Ruby, but only as much as the front-end stuff goes - starting a Rails project on my own would be a massive undertaking for me.
Given the choice, I'll do things in PHP because it's quicker and I have more experience on it. Jumping ship would be like abandoning 10 years of experience so I can start from scratch - I don't have the time to do that.
Everyone has their own languages of preference, and personally I really dislike working with python (not too much experience in ruby) while dealing with websites. I cringe each time I'm forced to check the manual for random function behavior, but its not enough to make me move over.
What I'm really looking for is an improved version of PHP. One that keeps most of its style but removing the backwards-compatible crap. It looks like HipHop may go down that path in the near future (they've already added python-style yield generator functions)
After a lot of thought, I've arrived at the conclusion that this is because PHP has its request handler and template language all baked into the same process. It's pretty great at that - no setup required to start slinging code.
Other than that (which is significant), I'm hard-pressed to find an advantage. It's verbose, inconsistent, lacks features that've been present in other languages for years, and as the article author complains about, has no real vibrant packaging system for leveraging code re-use. Code re-use in PHP is "copy-and-paste". Yikes.
Like many Ruby developers, I left PHP because I saw the kind of stagnation the author describes at the beginning of this article. I saw lots of good ideas originating and flourishing in the Ruby world, and sometimes trickling back to PHP. I saw a more well-thought-out language that seemed worthy of all that attention. So I hopped.
The libraries and library management tools and frameworks available to me now are awesome. Ruby itself is getting faster all the time. Is there really any reason left to stick with PHP other than inertia? (I don't mean that dismissively; if you have a massive existing code base, that's real inertia and changing would be a tall order.)
You can substitute Python or Node or whatever for Ruby here, but my point is: why fight the uphill battle to bring good tools to a language when other languages already have them?