I know, micro-optimization is bad. But curious as I am, I did a little benchmark using this script:
Resulting data (for numof = 100000):
i: 0
elseif took: 6.2942504882812E-5
switch took: 3.504753112793E-5
i: 10
elseif took: 6.4849853515625E-5
switch took: 4.3869018554688E-5
i: 100
elseif took: 0.00014805793762207
switch took: 0.00011801719665527
i: 1000
elseif took: 0.00069785118103027
switch took: 0.00098896026611328
i: 10000
elseif took: 0.0059938430786133
switch took: 0.0074150562286377
i: 100000 (first non-existing offset)
elseif took: 0.043318033218384
switch took: 0.075783014297485
Have run the script on my old and slow windows machine with PHP 5.3.1 or 5.3.2, dunno right know.