Can't make this stuff up.
Can't make this stuff up.
Like the fact that the language's grammar is used to do primitive type checking, meaning some combinations of accessors cause errors.
Or the fact the mail sending function doesn't work if one of the lines in the email begins with a period, but only if you're on Windows.
That's one of the many problems with PHP's underlying design philosopy: instead of providing a higher-level interface that stays consistent across platforms, it exposes low-level OS gunk and gotchas through its thin wrappers on low-level-ish functions. I put together phpbestpractices.org a few months ago in an attempt to document some of those common gotchas and provide sane alternatives.
Except they're not really that thin.
>in Windows it wraps the local mail program which seems to have a gotcha with periods
Nope, in Windows it implements the SMTP protocol, on UNIX it runs sendmail.
>instead of providing a higher-level interface that stays consistent across platforms, it exposes low-level OS gunk and gotchas through its thin wrappers on low-level-ish functions.
Except it doesn't. There's quite a few things that are named like OS functions, but are implemented internally. For example, all the C stdlib-like string functions.
I can't think of another way to do it that wouldn't effectively reduce to this anyway.
Also, I wouldn't be worried about one lookup. I'm pretty sure everything in PHP is in a hash map.