Skip navigation.

Vector graphics in Javascript #

This is impressive. A vector graphics library built using div layers and javascript. The mind boggles at what is possible: function graphing.

PHP compilers #

The number of implementations of PHP continue to rise and rise. Among those I can list are:

  • Recently, Caucho wrote a PHP5 to Java bytecode compiler and built it into their Resin server. There's not much information, but in the link, look for thread responses by Scott Ferguson, the compiler author.
  • The experimental Pint, a PHP to parrot compiler.
  • The commercial Roadsend PHP to binary compiler.
  • The .NET framework Phalanger, a PHP to MSIL compiler (added 22 Dec 2005).
  • The original mod_php from
  • The PHP4Mono compiler for Mono (added 27 Feb 2006).

I am excited about all these implementations. Most computationally intensive compiler benchmarks have shown a 5-10 times speedup over mod_php. Perhaps it is only a matter of time before we see a JIT compiler for PHP to Intel opcodes, built into mod_php...

A more curious question is why there has been so little takeup of these faster technologies. Some speculation here:

  • PHP is fast enough? The bottleneck is the database or the network, and not PHP?
  • PHP 4->5->6 is changing too fast to trust someone else?
  • No formal PHP specification or conformance suite makes switching more risky?
  • Not all PHP extensions or libraries are available on other platform?
  • Lack of knowledge or awareness? Or are we still in early adopter stage?

Is Ruby brainwashing us? #

Bruce Tate recently wrote a book "Beyond Java" that is critical of Java and praises Ruby excessively. The book has very few positive things to say about PHP.

Well, my personal preference in terms of language is a simple clean C-like syntax. I want something that I can teach programmers in 2 days. I don't want an unfamiliar syntax that requires relearning a lot. I don't want programmers to agonize for hours on the right way to code something new. That's why I don't particularly like Ruby's syntax (though i admit i am a novice at Ruby). In contrast, PHP is basically C (or C++ or Java) with $ signs in front of variables - it's that easy.

You want clean coding? Well K&R code formatting works just as well with C, C++ and PHP.

Large scale programming? The principles you used in software engineering with applications developed in C apply just as well to PHP!

Recently, on Mike Naberezny's blog, I saw the following code comparison:


to = %w(Paul Matthew Daniel)
loop do
  from = to.sort_by { rand }
  pairs =
  next if pairs.any? { |t, f| t == f }
  pp pairs

$from = $to = array(‘Paul’, ‘Matthew’, ‘Daniel’, ‘Andi’, ‘Chuck’);
for (;;) {
    foreach ($from as $i => $f)
        if ($to[$i] == $f) continue 2;
print_r(array_combine($from, $to));

As you can see, for this example, Ruby and PHP are about equal in power of expressiveness, but I suspect that a Java or C programmer would comprehend the PHP one faster. And PHP functions such as strpos() and strcmp() make switching from C much easier. We even have an ADO compatible db class library for developers with an ASP background, and I believe some people are trying to clone jdbc. All we need now is for someone to implement a clone of the java string library and we are all set to win everyone over :)

I do admit that Ruby appears to have some features that would appeal to Smalltalk fans, but that remains a small minority. Ruby on Rails is nice, but I think my company's inhouse PHP framework is more powerful, other people are coming out with equally powerful open source PHP frameworks.

I'm glad I'm not the only one who feels that way. Bruce Eckel, a well-known Java and Python expert, also feels that Ruby is over-hyped:

I think we've mostly been hearing from people who have come from Perl and found Ruby to be a "better Perl, with objects that work," or people who are finally convinced that dynamic languages have merit, and so mix the enthusiasm of the first time dynamic language user (quite a rush, as I remember from my 2-month experience with Perl many years ago) with their experience of Ruby.

To my surprise, Bruce adds:

I've been bumping up against the problem of "but all I want to do is connect a database to the web" in Zope2 [a popular Python framework] for several years now. Oh, it's definitely something you can do, but unfortunately it's past the knee of the "Z-shaped learning curve," and is only trivial if you live and breathe Zope every day.

Don't get me wrong; Zope is an excellent system and incredibly powerful, and Zope3 may be much easier, but I'm out of steam. I have realized that on my site, I really just want to do a collection of simple things, and I don't want to relearn Zope every time I want to accomplish something... -- I'm going to find something drop-dead simple to solve my drop-dead simple problems. Probably PHP5, which actually includes most of Java and C++ syntax, amazingly enough, and I wonder if that isn't what made IBM adopt it.

PHP continues to gain momentum...

PS: Also see what Sam Ruby, one of the core PHP developers and implementor of the first PHP to Java bridge, has to say about Beyond Java.

PPS: Added 22 Dec: Also see Tim Bray's point of view.