How-to: PHP Script for Honey Pot’s http:BL

A few days ago, Project Honey Pot introduced a new service : http:BL, a blacklist of all the suspicious IPs they are gathering through all the honey pots, and an API allowing anyone to use this blacklist. Their API is very easy to use, and I believe a number of projects (hint) should use it any time soon. For the…

PHP GD : imagecolorallocate() Limitation

Did you know it ? PHP GD's imagecolorallocate() can only allocate 255 colors in a palette based image created by imagecreate() (no such limitation when you use function imagecreatetruecolors() by the way). This sounds pretty stupid as well as rather undocumented, but anyway, here is a new version of my GD Gradient Fill PHP class, which now produces correct colors…

PHP : Variables vs Constants

I thought, and had been told, that using constants instead of variables in PHP was mostly a matter of speed : at run time, the engine replaces every occurrence of a constant with its hard-coded value, making code presumably faster than using variables that must be evaluated each time they are encountered. Or something like this. Wondering how big or…

PHP5 Benchmarks: for vs while, count vs sizeof, md5 vs sha1 and other speed comparisons like these for those who really need an extra millisecond of optimisation. I like this.

#

Plugin Debugging : Hooks and Filters Flow

Basically, a plugin for WordPress creates a PHP function (called a filter or an action) which is triggered when a particular event (called a hook) occurs. When several filters are supposed to be triggered by the same hook, you can define their priority. When you're writing a plugin and you're facing unexpected behavior, it may be a priority issue :…