diana253 Posted March 13, 2006 Share Posted March 13, 2006 [code] function filter($res){ $y_arr=""; $y_arr = queryYahoo(""); //split strings into array of 10 $y_arr = split ("<LI>", trim($y_arr)); $y_res = ""; $count = count($y_arr); for ($i=1; $i<$count; $i++) { $y_1 = explode ("class=yschurl>",trim($y_arr[$i])); $y_2 = explode ("</EM>",$y_1[1]); $y_URL[$i] = $y_2[0]; $y_res[$i]= $y_arr[$i].$y_URL[$i]; } return $y_res[2];}[/code]imagine the search results you got from yahoo..right now i have an array containing all the results in array format..the $y_res[2] contains - $y_arr[2] <--- result desc - $y_URL[2] <-- result URLWhat i want to do is, i want to combine the $y_arr[] and $y_URL into one array as associative arrayi've been trying to do this for about two weeks already but nothings seem to be working..i guess maybe it's because the [$i] thing..i dont know how to do it..please help me here~~~ Quote Link to comment https://forums.phpfreaks.com/topic/4855-combining-two-array-into-associative-arrayin-loop-structure/ 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.