Happy Birthday, PHP...

As Slashdot observes, PHP was born 10 years ago on June 8th 1995.

It's had its knockers, but it's running this site...

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

why PHP?

I often wonder why PHP became so popular. Was it all marketing or luck? Why couldn't Python or some saner language achieve the same success?

Here's a great graph of scripting language popularity. There are some interesting tipping points: http://www.realmeme.com/miner/java/scriptinglanguagesDejanews.png

I think PHP's success is mostly due to being Perl-like, not CGI, and (most importantly) easy to install. I hate PHP, but I kept using it because my web hosting company had already installed PHP. I just needed to create .php files and scripting Just Worked(tm). I've since sobered up and use Python.

?

Do you think the Slashdot servers can hadnle all the traffic a LtU link generates? ;-)

Accidental Programming Language?

Lot's of tools start out in life not intending to be used as a full fledged scripting language, but sooner or later that's how they get used. The original PHP announcement ("You do not need access to Perl or Tcl or any other script interpreter"), sounds similar to what the Ant author had to say about his tool:

Now, I never intended for the file format to become a scripting language—after all, my original view of Ant was that there was a declaration of some properties that described the project and that the tasks written in Java performed all the logic. The current maintainers of Ant generally share the same feelings. But when I fused XML and task reflection in Ant, I put together something that is 70-80% of a scripting environment. I just didn't recognize it at the time. To deny that people will use it as a scripting language is equivalent to asking them to pretend that sugar isn't sweet.

Wondering whether the world of tools would be better off just recognizing that they should engage in PL design up front to save us all the trouble later on?

An interesting question:

One manner for PLs to become popular, of course, is to fill a niche reasonably well. PHP and server-side scripting is a canonical example.

What often happens, of course, is a (useful) domain-specific language starts to become more generic in nature, as it gathers more users who want more capabilities.

Most such languages aren't terribly useful (or widely used) outside of their original problem domains; but they do get used quite a bit where they were originally intended.

My advice? Don't worry about it. PHP is fine for certain tasks, that's where it gets used. Now if the PHB were to tell me that the company I work for has standardized on PHP for all development; I might start working on my resume. But PHP is adequate and useful for web-scripting, even if there exist tools which are arguably better (and there are plenty of those).

Too many people here fret about industry using languages which are merely adequate rather than ideal. Which to my mind, is like people upset that others have the bad taste to drive a Toyota when for only 3x the price, they could have a Benz.

Well, if a language is better

Well, if a language is better than another, we would expect the total cost of using it in its niche to be lower.

I don't mind ad hoc languages

But all of them go through growing pains, leaving those of us in the wake with frustration of what could have been. I deal with too many languages that spontaneously arose in domain or application specific contexts. It's usually not the syntax that drives me nuts - it's the stuff that's close but not quite. You can almost get what you want, but to get that last 5% you have to code kludge after kludge and the workarounds end up occupying more code than the 95% that works as advertized.

Not really asking tools designers to do full scale PL design. But a little consideration upfront would go a long way to providing a long term roadmap to ease the pain of success.

Exactly

I guess that's why I use Lisp macros to do the same stuff :D Why a new ad-hoc language with weird syntax etc.?

Scripting

Lot's of tools start out in life not intending to be used as a full fledged scripting language, but sooner or later that's how they get used.

Strange, it doesn't seem that long since people were saying that sort of thing about scripting languages: “X started out life as a scripting language and not a full fledged programming language, but sooner or later that's how they get used.” Seems there is always pressure on any language to become more general purpose. But then, when they do, they seem to be no longer suitable for simple configuration/"scripting" tasks. I think there just needs to be more awareness that at the heart of almost any non-trivial application there is an interpreter of some kind, and so you may as well make it "full-blown". I don't think this means that more people should engage in PL design, though. A better solution would be for people to reuse pre-built language interpreters to encourage code reuse. This was the original idea behind Tcl and scripting, and I think it is still a valid one.

Every general-purpose application programming language should include some sort of interpreter in its standard library, whether for the same language, or a sub-set, or a completely different language. People should think of interpreters (and parsers, pretty-printers, type-checkers, and even compilers) as being basic building blocks of software engineering, and not fancy add-ons.

You got that right!

People should think of interpreters (and parsers, pretty-printers, type-checkers, and even compilers) as being basic building blocks of software engineering, and not fancy add-ons.

Hear, hear.

popularity

I think it became so popular mainly as a grass-roots thing for hobbyists, beginning programmers and people who had been writing Perl CGI scripts back before heavily-architectured web applications were so commonplace.

PHP succeeded because it felt like a simpler and less confusing Perl that did more stuff for you and had more useful web-development functionality built in. It was easy to embed in HTML, made it quicker to 'get stuff done' and lowered the barrier to writing simple dynamic webpages.

I think the main issue with Python is the whitespace thing. It just doesn't embed into HTML well. Now of course people will frown on that practise anyway, but the sort of hobbyists driving the popularity of PHP aren't that interested in learning about MVC, they just want to get a few small pieces of dynamic functionality working on their website.

bye, PHP

hello, Ruby and Rails! :)

Ruby

I think we should pay more attention to Ruby than we do.

no doubt about it

It's Python, Perl, Scheme and Smalltalk all in one nice compact, clean, well thought-out package. :)

It's missing the Python (but

It's missing the Python (but the Ruby PEPs into Python, so we can be happy still :-).

How about the keyword def? O

How about the keyword def? Or keyword arguments mostly like Python? Clearness of syntax comes to mind too...

I agree

Not only is Ruby growing in popularity, it's also at least as suitable as Python for PL theory newbies to play around with ideas in (it beats Python outright on two counts: proper lexical closures and continuations).

With Rails, Ruby has really come into its own as a language for web application development - there are ideas in there that plenty of people (most of the Python community, for instance) seem to think are worth stealing. (I think it's worth seeing what Haskell can really do in the same area, but that's a project for another day...).

I find the ruby syntax hideou

I find the ruby syntax hideous, and as far as I can tell the standard library is tiny. It doesn't have any advantages over scheme, only really disadvantages. Why do people keep using it?

Ruby and Scheme

Well, I find Scheme syntax hideous, and it's standard library is yet smaller than one of Ruby. I don't understand your comment.

Perhaps I was looking in the

Perhaps I was looking in the wrong place, but I would say that the standard library was smaller when I looked at it about 18 months ago.

To address the syntactical po

To address the syntactical point more seriously, I found the syntax of ruby confusing and arbitrary, moreso than Java, and not in a good way like Perl, which is at least intuitive for people who know various Unixoid scripting tools. Out of fairness, I won't attempt a comparison with the elegance, simplicity, and beauty of s-expressions.

While syntax does remain a matter of personal preference, there is some objective difference in how it affects learning and use - once you understand how s-expressions fit together, and the syntax of lambda, the only syntactical learning you need in scheme (excluding the existence of macros) is the meaning of the arguments to functions - sometimes a big step at the beginning, then only minimal learning afterwards; while in a pathological language in which every linguistic element had its own rules, you would be learning for a lot longer. I would venture that scheme is not universally the highest productivity language there is because different syntaxes are more likely to be remembered and not jar programmers flow of thought than others depending on the predilections of the individual programmer.

Uh?

While personal preferences may vary, you do realize that you have weird taste, don't you?
Preferring Scheme syntax or Ruby, bah, those are so different as not being comparable..
But Perl's syntax over Ruby??
Very, very few people agree with this..
Some people prefer Perl because of its library which is a good reason, but its syntax..

I don't use perl very much, b

I don't use perl very much, but perl's byzantine syntax is good for its (original) target userbase: people who use other unix text processing/system tools, because it provides a relatively easy transition from those tools. This is why its crufty syntax is arguably a good idea, while cruft in a totally new language is quite inexcusable.

care to elaborate?

What cruft exactly is that you speak about? And you still didn't say exactly what is wrong with the syntax...

Simply saying Perl or Java syntax are better and less "crufty" than Ruby's will only make you look like a fool...

Some examples might help, if you actually know the language, that is.

Personally, i find the syntax Smalltalk one better.

As I've said, it's been somet

As I've said, it's been something like 18 months since I used it. Care to elaborate why indicating a preference for the syntax of languages that are used by many times the number of programmers of ruby would make me look a fool?

Because i see no such cruft a

Because i see no such cruft and would like you to explicitely point it out. If you know Perl, Python or Smalltalk, you're home, only with a simpler syntax ( except perhaps for Python ).

i wonder...

I find the ruby syntax hideous,

Considering it doesn't even need much punctuation in the syntax, like in stupid languages like Java, and doesn't even require much scaffolding code to make things work the way it should ( principle of least surprise ), like defining lots of get and set methods for declaring a managed property, like, again, in Java, i wonder what would you be referring to...

is it the @foo, @@foo and $foo syntax for succintely declaring an instance, class or global variable, respectively? It's so frigging smart and nice, but somehow, people like you are making Matz ( Ruby's creator ) into considering removing said features. So, some time you probably will do just as in java: declare static foo or global foo or something...

Too bad when languages become popular they begin stuffing it with stupid stuff from regular, everyday job languages...

and as far as I can tell the standard library is tiny.

As someone already said, the standard out of the box lib is already larger and more useful than that of R5RS Scheme, but anyway, try this:

http://raa.ruby-lang.org/

It's a great repository of nice ruby libs. Yes, DB access stuff ( Perl's DBI style interface ), web and client-side GUI stuff as well...

Yeah, I publicly apologise fo

Yeah, I publicly apologise for liking such bloated everyday languages as scheme.

no need for that. you are fo

no need for that. you are forgiven. But i find your lack of faith in Ruby disturbing. :)

Another repository of Ruby libs

Perhaps better than RAA is www.rubyforge.org