Jump to content

Archived

This topic is now archived and is closed to further replies.

craygo

array_combine

Recommended Posts

I am helping a friend and I need to combine 2 arrays. I know there is a simple function in php5 called array_combine. But he has php 4.x.x. Any one know a work around without having to install php5.

Thanks

Ray

Share this post


Link to post
Share on other sites
Isn´t you talking about merging? (array_merge)

you can make a function to combine... That´s not hard.

Share this post


Link to post
Share on other sites
a very simple function to combine:

[code]
<?php

function ericsCombine($a1, $a2){
    $output = array();
    foreach($a1 as $key => $value){
        $output[$value] = $a2[$key];
    }
    return $output;
}

?>
[/code]

or something like that...

You can work a little more on this function, it can get better...

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.