Home >> Snippet List >> Snippet

Name
Combining two arrays into one
Description
A quick bit of code for combining two arrays into one
PHP Snippet
<?PHP
 
FUNCTION array_combine($arr1, $arr2) {
     $out = ARRAY();
 
     $arr1 = ARRAY_VALUES($arr1);
     $arr2 = ARRAY_VALUES($arr2);
 
     FOREACH($arr1 AS $key1 => $value1) {
     $out[(string)$value1] = $arr2[$key1];
     }
 
     RETURN $out;
}
 
?>