The hashtable closure pattern

I noticed that I was using a pattern of my own more and more. It is actually very usefull, for several reasons. It may have been used by other before me, but never saw a name for it.

This pattern is useful when you have to apply an operation dependent on parameters several times. for example when you want to apply a calculation on all elements of an array, the calculation depending on some parameters. This article will explain you that pattern and demonstrate how it can be used in Javascript, PHP and D.

This pattern can be used in any language that support first class function and hashtable, that is becoming more and more common (closure support was added in PHP as of version 5.3).

Continue reading

The PHP is an HTML element, not a PHP one.

On many Internet websites, you’ll come across article explaining you HTML and PHP. But none of them teach you that the PHP tag should be considered as an HTML element, not as a PHP one. Worse, many example you’ll find does this mistake again and again. This article is PHP centered, but apply to other technologies like JSP or most templates systems, where code is mixed with logic.
Continue reading