note 93863 deleted from function.array-map by danbrown

From: Date: Mon, 05 Oct 2009 14:35:10 +0000
Subject: note 93863 deleted from function.array-map by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-161363@lists.php.net to get a copy of this message
Note Submitter: Anonymous ---- @macnimble a simpler way could be <?php function prefix_keys(array $array, $prefix = null, $postfix = null) { foreach($array as $key => $val) { $newkey = $key; if(null != $prefix){ $newkey = $prefix.$newkey; } if(null != $postfix){ $newkey = $newkey.$postfix; } $newarray[$newkey] = $val; } return $newarray; } ?>

« previous php.notes (#161363) next »