[development] Note that PHP arrays are fast
cxjohnson at gmail.com
Tue Apr 10 10:02:19 UTC 2007
On 4/10/07, Rob Thorne <rob at torenware.com> wrote:
> While I use these kind of array tricks all the time (love that table
> driven code), the advantage of the first form is readability. Unless
> code like that is called many times in a request, I'd still go with the
> ?: operator, since the intent is clearer.
> Remember: we have to maintain this stuff after we write it.
> On the other hand: I like dispatch arrays lots better than huge case
> statements. I suspect that these are not only faster, but easier to
> understand as well.
Huh, that's interesting. As someone who spent years maintaining a
huge multi-process application written in assembly language -- where
jump tables (dispatch arrays, essentially) are The Rule -- I find case
statements much easier to read in most (not all) situations.
I think that means we may not reach a consensus on readability for
some such things.
More information about the development