A good tip from Zend, who recommend omitting the closing PHP tag (?>) when your files contain pure PHP code. This can prevent additional whitespace being inserted into the script output. Extra whitespace can cause problems, for example, if you are trying to set your own custom HTTP headers: nothing should be output before the call to the header function. Otherwise, this classic error will occur:
Cannot modify header information - headers already sent by (output started at myinclude.php:16) in myscript.php on line 15
I have a love-hate relationship with PHP’s class repository (and answer to Perl’s CPAN), PEAR. Sometimes you can find very useful, well documented and cleanly implemented packages. And obviously re-using such components is a big-win. Sadly, the quality of PEAR varies wildly and frequently I stumble upon useful looking packages that have little or, worse, no documentation. This situation, regardless of the underlying code, puts me off more than anything.
Interesting article from Zend co-founder Andi Gutmans on how the Java world is leveraging dynamic languages such as Ruby and PHP in order to remain relevant in the web application world. The obvious question is, though, whether using JRuby has enough advantages over using Ruby or PHP in a plain Linux environment without a JVM.
Today Sun is investing in JRuby Ruby and Jython Python support for its Java EE solution; the IBM Websphere group has realized the ineffectiveness of the Java EE platform for running modern Web workloads and has invested heavily in Project Zero which aims to make big blue a Web 2.0 player and initially delivers support for Groovy and PHP; BEA has also had some incubation projects going but with the upcoming sale to Oracle it is unclear whether any of those efforts will materialize.
David Heinemeier Hansson, the creator of Rails, praises PHP for being adequate for “small chores”. Wow, what a compliment! Perhaps someone should suggest to Dave that Rails is okay too, as long as you don’t care about performance.