]> andersk Git - sql-web.git/blobdiff - lib/joe/util.lib.php
array_prepend_keys
[sql-web.git] / lib / joe / util.lib.php
index dd7be0aa74fd709526d41094797ac899f9126cd8..1ce55cca57540d0d6f94c98f506effa2a91d994a 100644 (file)
@@ -83,7 +83,7 @@ function fetchRows($rs, $key = null) {
             while ($r = mysql_fetch_assoc($rs)) {
                 $arr[] = $r;
             }
-        } elseif (is_numeric($key)) {
+        } elseif ((string)intval($key)===(string)$key) {
             while ($r = mysql_fetch_row($rs)) {
                 $arr[$r[$key]] = $r;
             }
@@ -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.026536 seconds and 4 git commands to generate.