craygo Posted September 21, 2006 Share Posted September 21, 2006 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.ThanksRay Quote Link to comment https://forums.phpfreaks.com/topic/21535-array_combine/ Share on other sites More sharing options...
eric1235711 Posted September 21, 2006 Share Posted September 21, 2006 Isn´t you talking about merging? (array_merge)you can make a function to combine... That´s not hard. Quote Link to comment https://forums.phpfreaks.com/topic/21535-array_combine/#findComment-96103 Share on other sites More sharing options...
eric1235711 Posted September 21, 2006 Share Posted September 21, 2006 a very simple function to combine:[code]<?phpfunction 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... Quote Link to comment https://forums.phpfreaks.com/topic/21535-array_combine/#findComment-96110 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.