#27225 [WFx]: in_var function

From: Date: Wed, 11 Feb 2004 22:35:50 +0000
Subject: #27225 [WFx]: in_var function
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-54785@lists.php.net to get a copy of this message
 ID:               27225
 User updated by:  chris dot walsh at pni dot com
 Reported By:      chris dot walsh at pni dot com
 Status:           Wont fix
 Bug Type:         Feature/Change Request
 Operating System: Linux
 PHP Version:      4.3.5RC2
 New Comment:

That works... as does an ereg() call, but it seems kind of clunky to
have to create an array and then call an array function (or use a
pattern match), when it would be more efficient to have a
function/operator that deals directly with the string.

Just my two cents...


Previous Comments:
------------------------------------------------------------------------

[2004-02-11 17:30:18] derick@php.net

if (in_array("a", array("a", "b", "c"))) works fine for this
:)

------------------------------------------------------------------------

[2004-02-11 17:10:40] chris dot walsh at pni dot com

Description:
------------
Looking for a comparison operator/function to similar to the mysql "in"
function.

This could be used to replace long if statments:
if($a=="b" || $a=="c" || $a=="d")

something like
if(in($a,"b","c","d"))
or
if($a=="b"||"c"||"d")
or
if($a|="b","c","d")




------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=27225&edit=1


Thread (3 messages)

« previous php.bugs (#54785) next »