The PHP Singularity

Adding a month to a UNIX timestamp, C vs. PHP: https://gist.github.com/3019006

That’s right: PHP managed to screw up a perfectly good C API. How do you screw up a trivial wrapper around a C function?

Sure, I can make this code clearer by asking for an associative array, but that’s not the default behavior. That still doesn’t let me pass the array back into mktime, for two reasons: mktime expects each element it cares about as a separate argument, and mktime doesn’t use compatible bases for the month or year.

This type of nonsense is spread out all over the language. Yes, things have improved with PHP 5 over 4. At least objects are passed by ‘sane reference’ now (there’s no other way to get a sane reference in PHP, so in 4 you were screwed unless PHP’s odd take on references happened to work out for you). PHP’s learned to fake it a little better, but it still does not behave like a reasonable language.

Sure, you can get work done in PHP, but I’m all for coming up with something better and using it wherever it makes sense.