Jump to content


This topic is now archived and is closed to further replies.


combining two array into associative array..in loop structure

Recommended Posts

function filter($res)
    $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];

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 URL

What i want to do is, i want to combine the $y_arr[] and $y_URL into one array as associative array
i'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~~~

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.