Patch 2

The nearest PHP solution. Needs, syntaxically, to factorize on each call, but it works.