note 52627 deleted from function.array-search by felipe

From: Date: Sun, 10 Feb 2008 13:09:53 +0000
Subject: note 52627 deleted from function.array-search by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-135953@lists.php.net to get a copy of this message
Note Submitter: kmkz [AT] kmkz [DOT] com ---- I always wanted an array_replace function that could search and replace within an array, so I made one (its kinda simple and a bit inefficient, but c'est la vie): <?php function array_replace($search, $replace, &$array) { foreach($array as $key => $value) { if($value == $search) { $array[$key] = $replace; } } } ?>

« previous php.notes (#135953) next »