From: Brian Candler Date: 2003-05-05T19:06:11+09:00 Subject: Re: Why is PHP so popular? What can we learn from the PHP camp? On Mon, May 05, 2003 at 02:36:21PM +0900, Phil Tomson wrote: > ....and what can we learn from PHP's rapid rise to success? > > I've seen quite a few jobs which require PHP experience lately and I > wonder why; what's PHP got that Ruby doesn't? I don't know if PHP was actually first with the concept of "embedding code directly in a HTML page", but it certainly seems like that. You can get the same functionality with Ruby + eRuby. However it seems PHP started with this as its primary goal, starting with a very restricted language which slowly became more general-purpose. http://www.php.net/manual/en/history.php Secondly, PHP comes with tight Apache integration out-of-the-box. (Ruby has mod_ruby) Thirdly, PHP is packaged together with all the libraries you might want, which makes it simple to install and with a consistent set of features from platform to platform. (ruby-sumo would be our equivalent I think) So overall, I just think it was first in the market segment of "HTML hackers who want to embed some code in their pages but who don't know much about programming", which is a very large market. Ruby plays in that market too, but IMO is much more general-purpose. Perhaps another interesting question to ask is: why has PHP not taken off as a general-purpose scripting language? I was asking one of my colleagues about this: he writes web apps in PHP, but still uses perl for command-line driven scripts. What is it about PHP which means you don't use it for command-line apps, I asked? He wasn't able to answer really, or point to anything in the language which made it unsuitable. Somehow it just didn't "feel right" to him to be using PHP outside of HTML! Incidentally, I had a look at some of his PHP code, and it is written in a very object-oriented style with lots of $this->dosomething(arg) calls. For someone used to that horrible syntax, Ruby is an easy sell :-) http://www.php.net/manual/en/language.oop.php Regards, Brian.