note 64192 added to function.array-search

From: Date: Sun, 09 Apr 2006 13:10:32 +0000
Subject: note 64192 added to function.array-search
Groups: php.notes 
Request: Send a blank email to php-notes+get-107640@lists.php.net to get a copy of this message
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 } ?> ---- Server IP: 84.18.202.180 Probable Submitter: 82.2.185.211 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.array-search.php Edit -- http://master.php.net/note/edit/64192 Del: integrated -- http://master.php.net/note/delete/64192/integrated Del: useless -- http://master.php.net/note/delete/64192/useless Del: bad code -- http://master.php.net/note/delete/64192/bad+code Del: spam -- http://master.php.net/note/delete/64192/spam Del: non-english -- http://master.php.net/note/delete/64192/non-english Del: in docs -- http://master.php.net/note/delete/64192/in+docs Del: other reasons-- http://master.php.net/note/delete/64192 Reject -- http://master.php.net/note/reject/64192 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#107640) next »