NYCPHP Meetup

NYPHP.org

[nycphp-talk] Casting and list

Daniel Kushner nyphp at websapp.com
Mon Dec 22 16:30:24 EST 2003


Hans,

Assuming that this code will be executed on every (or most) database
queries, it would be much more efficient to use a switch statement instead
of all those else/if's.
There should also optimally be a catch all, just incase all if's are false.

--Daniel



> -----Original Message-----
> From: talk-bounces at lists.nyphp.org
> [mailto:talk-bounces at lists.nyphp.org]On Behalf Of Hans Zaunere
> Sent: Monday, December 22, 2003 4:17 PM
> To: NYPHP Talk
> Subject: RE: [nycphp-talk] Casting and list
>
>
>
> > to do this type of thing.  It's a type-sensitive mysql_fetch_row()
> > (which is really what I'd like):
> >
> > http://pcomd.net/mysql_get_row
> >
> > but it's a little heavy and annoying in some ways.  Alas, the yin-yang
> > of a type-less language.
>
> In case anyone is interested, I ended up just revising the above PCOM to
> be more robust.  After the revision, I dropped the function into our
> development intranet site and it's running smoothly without any
> performance change - of course, it is an intranet :)  The actual
> castings done by mysql_get_row() are documented in the source - it's
> just a type cast mysql_fetch_row().
>
> H
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
>





More information about the talk mailing list