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? Link to comment https://forums.phpfreaks.com/topic/87977-solved-build-an-array_combine/ 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; } Link to comment https://forums.phpfreaks.com/topic/87977-solved-build-an-array_combine/#findComment-450136 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! Link to comment https://forums.phpfreaks.com/topic/87977-solved-build-an-array_combine/#findComment-450143 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. Link to comment https://forums.phpfreaks.com/topic/87977-solved-build-an-array_combine/#findComment-450153 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.