[nycphp-talk] Casting and list
Daniel Kushner
nyphp at websapp.com
Mon Dec 22 16:47:31 EST 2003
> I was on the fence about this, too. From what I've
> heard/read/understood, switch statements become more efficient than
> if/else when there are about 4 or more test cases (switch statements
> have a considerable overhead to setup). This is from C, so frankly I
> don't know if it holds true under PHP, too. I'd be interested to see
> both cases run through some profiler and I'll change the PCOM
> accordingly :)
>
> > There should also optimally be a catch all, just incase all if's are
> false.
Could you send me some stand-alone code (2 versions) that I could abuse in
the Zend Profiler?
> The catch all is implied. If the type isn't known, the type should be a
> string, which is what mysql_fetch_row() itself always returns - so no
> need to do any casting.
IMHO PCOM would be more robust the less it relies on other API's. But I
guess that the chances of mysql_fetch_row() changing it's behavior is very
remote.
--Daniel
More information about the talk
mailing list