sandy1028 Posted November 21, 2007 Share Posted November 21, 2007 Hi, Please help me with this problem $city = $cityname[$i]; $centre=split(":",$centrelist); list($count,$centres) = split(":",$centrelist[$city],2); $listCentre = explode(":",$centres); When i give print $listCentre The output is Array Array Array Array Array $listCentre[0] contains 5 values and $listcentre[1] contains 3 values I want all the values in a single array. I have to merge $listCentre[1] and $listCentre[2] and $listCentre[3] in a single array called $list How can I do it Link to comment https://forums.phpfreaks.com/topic/78192-arrays/ Share on other sites More sharing options...
~n[EO]n~ Posted November 21, 2007 Share Posted November 21, 2007 You can merge arrays using array_merge e.g. <?php $result = array_merge($array1, $array2); print_r($result); ?> Link to comment https://forums.phpfreaks.com/topic/78192-arrays/#findComment-395702 Share on other sites More sharing options...
sandy1028 Posted November 21, 2007 Author Share Posted November 21, 2007 Hi, i have tried it. but not able to. I should merge $listCentre[0] and $listCentre[1] How can I merge it Link to comment https://forums.phpfreaks.com/topic/78192-arrays/#findComment-395703 Share on other sites More sharing options...
~n[EO]n~ Posted November 21, 2007 Share Posted November 21, 2007 What is in $listCentre[0] and $listCentre[1] ? Can you post more of your codes Link to comment https://forums.phpfreaks.com/topic/78192-arrays/#findComment-395706 Share on other sites More sharing options...
sandy1028 Posted November 21, 2007 Author Share Posted November 21, 2007 hi, Values is present. $listCentre contains 5 Arrays. Each $listCentre[0] contains values in it. I want all the 5 arrays to be merged as a single array Link to comment https://forums.phpfreaks.com/topic/78192-arrays/#findComment-395707 Share on other sites More sharing options...
snk Posted November 21, 2007 Share Posted November 21, 2007 do you mean to make a new string of those values? Link to comment https://forums.phpfreaks.com/topic/78192-arrays/#findComment-395719 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.