note 64192 deleted from function.array-search by bjori

From: Date: Mon, 10 Apr 2006 19:34:00 +0000
Subject: note 64192 deleted from function.array-search by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-107718@lists.php.net to get a copy of this message
Note Submitter: webmaster at adamkdean dot com ---- I was just looking at this function and it didn't seem to work how I wanted, so I created another one. <?php function array_value_exists($value, $array) { foreach ($array as $k => $v) if ($value == $v) return true; return false; } ?> Usage as is simple as: <?php $array = array(0 => 'one', 1 => 'two'); if (array_value_exists('one', $array)) { // exists } else { // doesn't exist } ?>

« previous php.notes (#107718) next »