Archimedees Posted November 23, 2007 Share Posted November 23, 2007 I have 2 arrays $arActive = ( Array ( [0] => active_0 [1] => active_1 [2] => active_2 [3] => active_3 [4] => active_4 [5] => active_5 [6] => active_9 [7] => active_12 [8] => active_17 [9] => active_18 [10] => active_19) $arMyServers = (Array ( [0] => troub [1] => ide [2] => prog [3] => berli [4] => maje [5] => ling[6] => teefix [7] => luegnix [8] => mar [9] => ser [10] => kan) Now, I want to create another array with the numbers in the values of $arActive (in the active_) as Keys and the values of $arMyServers as values. Those number should match the keys in $$arMyServers e.g $arActiveServers = (Array ([0]=> troubadix [1]=> ide [2]=> prog [3]=> berli [4]=> maje [5]=> ing [6]=>mar [7] => Which function should I use??? Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted November 23, 2007 Share Posted November 23, 2007 Do you think you could explain again? Maybe it's just me, but i've no idea what you're actually trying to achieve. Quote Link to comment Share on other sites More sharing options...
JovanLo Posted November 27, 2007 Share Posted November 27, 2007 i hope this is what you are looking for.. foreach($arActive as $key=>$value){ $value_array=explode("_",$value); $key_next=$value_array[1]; $final[]=$arMyServers[$key_next]; } Quote Link to comment Share on other sites More sharing options...
Barand Posted November 27, 2007 Share Posted November 27, 2007 www.php.net/array_combine() Quote Link to comment 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.