When I first got into web design, all code seemed impressive (and intimidating!). I remember thinking PHP and MySQL would be good to learn once I got past the basics of HTML and CSS. There's such a large legacy of web projects that use PHP, most notably WordPress and Drupal. Since I wanted to focus on those content management systems, it seemed like the natural next step.
The first time I took a PHP class, I was amazed at how intuitive it was. I felt like I was finally understanding how things work "behind the scenes" on the server side.
It was only later that I started hearing from programmers who put down PHP. Ruby on Rails is all the rage, and Python gets praise for its clean syntax.
What prompted me to think about this again was a blog post: Why PHP was a ghetto. I liked how the author was honest about its shortcomings, while mounting a spirited defense:
When most developers learned Ruby, they were learning Rails and MVC at the same time. PHP was in use for a full 10 years before that. So there really wasn’t a period of time when heinous Ruby was being written by novices. There was an established standard in place for Rails, and the barrier to entry was a much higher, typically keeping less experienced developers out.
He makes the argument that frameworks like Zend and CodeIgniter have made PHP much more competitive with rival languages. I'd like to hear what TechHui members think about that.
One part I found interesting was how a founder's personality permeates the programming language he invents:
Rasmus generally promotes abstention from using frameworks, and the use of PHP as more of a templating language. To him, this translates to raw speed and scalability (load-wise). To everyone else, this translates to piles of procedural spaghetti code, and unmaintainable projects. For roughly 10 years following the birth of PHP in 1995, this was how PHP projects were written.
That made me think of David Heinemeier Hansson, the founder of Ruby on Rails. Whatever else you might say about him, he is most definitely opinionated. And it shows in RoR.
For further reading, here's another post: 7 reasons I switched back to PHP after two years on Rails. Despite how the title sounds, that author doesn't bash Ruby on Rails.
A programmer friend gave me this advice: "Start with PHP. But don't stop there. Learn as many languages as you can."
Is the author making a comparison of PHP to Rails? That is probably not fair because PHP is language whereas Rails is a framework. Comparing PHP to Ruby or Zend Framework to Rails might be more appropriate comparison.
In terms of PHP as a language, I saw this article that kind of mocked fun at it but points out some of the pain points compared to Ruby - http://najafali.com/php-is-better-than-ruby.html
That being said, I prefer to say out of language debates because they tend to get religious (and I"m also more on the designing end of things anyway) :)
Use what works to drive the project forward and use what you know to get there.
It's like Jack Palance said to Billy Crystal in City Slickers as he held up his index finger, "It's just one thing. Find it and you'll be happy." Only later, Billy Crystal realized that the one thing he was looking for was different for everyone.
Yeah you are right :) I had only seen Marcus' excerpts and I guess he isn't making a comparison to PHP to Rails.
I think he brings up some interesting points and having worked with Cakephp and CI in the past, they are nice MVC frameworks that make PHP development much better than it used to be.
"PHP is a minor evil perpetrated and created by incompetent amateurs, whereas Perl is a great and insidious evil, perpetrated by skilled but perverted professionals." — Jon Ribbens
That pretty much sums it up.
The article by Derek Sivers is a bit outdated. Here is a more recent take, where Sivers switches back to Rails after reading the Ruby on Rails tutorial by Michael Hartl. Hartl's tutorial is worth taking a look at if you want to get into Rails 3. I recommend my students use that tutorial as I cover Rails in my web programming course.
In my web programming course, I teach the students PHP first, and we move on to Rails after that. Although as mentioned by Scott, PHP is a language and Rails is a framework, my students use them both to create web-based applications, and are given an option to use either one as middleware for their GWT or Flex web applications. Most students choose Rails with GWT, but this is probably more due to the popularity of Rails (in Hawaii) than for any technical reasons.
I like using PHP (without any frameworks like Zend), but I also enjoy the Rails framework. If you like to have more direct control over the way you implement things, I have found that PHP is quite flexible. In the early days of Rails, I found the way that new versions of Rails would often break existing projects annoying (something that was not much of a problem with PHP). But with Rails 3 and all the functionality the Ruby Gems add, I like Rails a lot more than I used to. At this point (since I started with PHP long before Rails), I can still do a wider variety of things in PHP than Rails, but this is most likely an ignorance about Rails on my part.
In the end, I think that you can find good ways to do things in PHP, Rails, Django (Python), JSP, or any of the popular choices for web programming. As long as you can find a good way to do things, I don't think it is too important what someone else might say to bash your choice. (It is worth looking at any technical reasons why someone doesn't like your choice, so that you can address those concerns to your satisfaction, though.)
Hey Vern - I'm glad you took the dive with Rails. I think its great that you spend so much time thinking about your students and the best approach to providing them with a quality education. If we had more educators like you Hawaii would be in a very different place.
I've always said that programmers should avoid language religion and be technologically promiscuous :-). A good programmer can create a solid Zend (PHP) app and a bad programmer can create a crappy Rails or GWT app. That being said I encourage new programmers to start with frameworks like Rails, Grails, Django or GWT rather than the PHP frameworks (Cake, Zend, etc.) I view PHP as a relic from the past, popular only because its been around for a long time, is relatively ubiquitous and runs on the cheap hosting providers. I generally fall into the Ribbens camp, but I acknowledge that its possible to write good PHP code.
PHP is easy to learn, but hard to master. This is a good and a bad thing.
I saw around a hundred of interviews with PHP developers and basically less than 10% were good enough to be hired (I must say here that we were searching for junior developers too). The problem in that when someone knows how to do a basic functionality in PHP (e.g., ?page=contact) that person thinks he knows PHP. This makes a problem of too many entry level PHP developers.
On the other hand there is lack of senior PHP developers. When I say senior I mean developer who knows at least one framework, has experience with optimization of high traffic websites (5 million visits or more / day), and can understand language of project managers and business analysts. Ok, there are many more things here, but you get the point.
PHP has many problems (mainly inconsistent naming, not 99% test coverage, etc.) because of backwards compatibility they're maintaining. One day they'll have to say that PHP 6 will not be backwards compatibile and do a big clean up. But that's not gonna happen since it would piss of all people still running .php3 files :)
I'm not saying any language is better than the other. And I'm really subjective, I'm PHP and Zend Framework certified. Maybe someday I'm gonna learn Ruby (+ RoR) or Python (+ Django) and would be able to give better comparison.
But with languages is like with women. For example, if you like blondes than no one will convince you that brunettes are a better choice :) It's thing of taste.