Your first scenario can been done in a similar fashion to how you are used to doing it in SQL:

if ( in_array($a, array(1,4,20,...) ) {}

Your second scenario doesn't seem like there is much of a problem because it will always be short (can only have 2 comparisons).

-Shawn


Jay Blanchard wrote:
[snip]
I'm sure I'll be flamed for this, but it seems to me that there should
be a
shortcut way to write:

If ($a == 1 || $a == 4 || $a == 20 || ...) {}

To something more like what SQL has...

If ( $a IN(1,4,20,...) ) {}

And same with the very helpful SQL BETWEEN 'function'.

Instead of

If ($a > 1 && $a < 20) {}

Why not

If ($a BETWEEN (1,20)) {}
[/snip]


You could write a function and share it with the rest of us!

-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to