Wednesday, January 28, 2009

Silly PHP, Trix are for Python

I just discovered that when calling a PHP function, you can't specify functions by parameter name. This is really annoying when you're calling a function with several default parameters and you just want to change the last one. Since you can't just specify the one you want to change by name, you need to include all the other default parameters in order and just change the one parameter you care about.

Case in point, if you want to call htmlentities with $double_encode set to false and the other default parameters unchanged, you have to write

htmlentities("myhtmlcode", ENT_COMPAT, "ISO-8859-1", false).

This is phenomenally absurd. Makes me miss Python... :(


No comments: