Wednesday, January 04, 2006

PHP is a great language!

One thing I have noticed, is that quite often, PHP developers who are seeking for new PHP features are prematurely trying to implement them in C. Although, there are definitely cases where you want to write your code in C, I think in some cases PHP is too quickly dismissed. Developing features in PHP not only takes less time, but is also less prone to bugs, easier to maintain, and more stable and secure. Also, in the majority of cases, whether such a feature were implemented in C or PHP, would not make a significant different to overall application performance.

It is for this reason, and for reasons of ease-of-deployment, that in the Zend Framework we are actually taking full advantage of the PHP language. We want to showcase what the language can do, and not drop into C when we feel challenged. Also, the fact that we are implementing everything in PHP will make it also much easier to deploy, as we will aim not to have dependencies on non-standard extensions. Of course we will depend on what we consider mainstream PHP 5 extensions such as SimpleXML, DOM, PCRE, sessions etc.

ZSearch, one the components we presented in the php|architect Webcast, is a great example of this. Despite the fact that a Lucene implemention does a lot of bits and bytes file access, we implemented it fully in PHP. Is it as fast as a C implementation? Most definitely not. Is it good enough for use on high-traffic Web sites. We believe so. Same can be said for our PDF implementation, ZPdf. As we wanted to make it eas easy as possible to manipulate Pdfs, without requiring users to have to recompile PHP, we decided to implement it 100% in PHP. Not only are we implementing the creation of Pdfs, but we are also going to enable reading Pdfs, traversing them, manipulating and then writing the changed document back to disk. The implementation will even include a PHP-based LZW implementation needed to support the latest Pdf standard.

I believe PHP is a great language and from my experience a lot of needed functionality can be written and maintained much better on the PHP level, and except for limited examples, we all know that most often the bottlenecks in Web apps don't lie in a bit more or a bit less code, but in a lot of variants of the stack such as database , file system and network acccess, and more...

Long live PHP!