phpretard Posted January 26, 2008 Share Posted January 26, 2008 With PHP4 Can someone give me a clue how to build an array_combine - vs - array_combine in PHP5 or maybe a link to a tutorial? Quote Link to comment Share on other sites More sharing options...
Barand Posted January 27, 2008 Share Posted January 27, 2008 try function array_combine ($keys, $data) { $res = array(); foreach ($keys as $i=>$k) { $res[$k] = $data[$i]; } return $res; } Quote Link to comment Share on other sites More sharing options...
phpretard Posted January 27, 2008 Author Share Posted January 27, 2008 Is there any way you could translate that? $url=unserialize($row['url']); $name=unserialize($row['name']); $link=$url; $link_name=$name; $narray=array_combine($link,$link_name); foreach($narray as $key => $item) echo "<a href=\"$key\">$item</a>"; Thank you for your quick response! Quote Link to comment Share on other sites More sharing options...
Barand Posted January 27, 2008 Share Posted January 27, 2008 Is there any way you could translate that? Returns an associative array by using the values from the keys array as keys and the values from the values array as the corresponding values. 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.