]> andersk Git - sql-web.git/commitdiff
array_prepend_keys
authorJoe Presbrey <presbrey@mit.edu>
Sat, 14 Apr 2007 22:40:23 +0000 (22:40 +0000)
committerJoe Presbrey <presbrey@mit.edu>
Sat, 14 Apr 2007 22:40:23 +0000 (22:40 +0000)
git-svn-id: svn://presbrey.mit.edu/php/lib@123 a142d4bd-2cfb-0310-9673-cb33a7e74f58

lib/joe/util.lib.php

index 80321c7656f3f453f6f20cc2ad7713767f35cdde..1ce55cca57540d0d6f94c98f506effa2a91d994a 100644 (file)
@@ -208,4 +208,14 @@ function formQSA($array=array()) {
     return $text;
 }
 
+function array_prepend_keys($lst, $pre) {
+       if (is_array($lst) && count($lst) && is_string($pre)) {
+               $rlst = array_combine(array_map(create_function('$a','return "'.$pre.'$a";'),array_keys($lst)),$lst);
+               if (is_array($rlst) && count($rlst)) {
+                       return $rlst;
+               }
+       }
+       return $lst;
+}
+
 ?>
This page took 0.035365 seconds and 5 git commands to generate.