From 4296b00f71faab4fe622f0252b77aaa19fdda96b Mon Sep 17 00:00:00 2001 From: Joe Presbrey Date: Sat, 14 Apr 2007 22:40:23 +0000 Subject: [PATCH] array_prepend_keys git-svn-id: svn://presbrey.mit.edu/php/lib@123 a142d4bd-2cfb-0310-9673-cb33a7e74f58 --- lib/joe/util.lib.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/joe/util.lib.php b/lib/joe/util.lib.php index 80321c7..1ce55cc 100644 --- a/lib/joe/util.lib.php +++ b/lib/joe/util.lib.php @@ -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; +} + ?> -- 2.45.0