Page 1 of 1

Merge Arrays (my ugly arrays)

Posted: Fri Feb 08, 2008 3:52 pm
by tmaiden
I'm still learning everyone so please bear with me.

Before I start with my actual question, maybe cleaning up my regexs may be the answer to fixing my arrays.

My Arrays

Code: Select all

preg_match_all("/<a.*? href=\"((.*?).torrent)\".*?>(.*?)<\/a>/i",$inputStream,$torrentlink);
preg_match_all("/<a.*? title=\"Details for (.*?)\">(.*?)<\/a>/i",$inputStream,$torrentname);
preg_match_all("/<td align=\"right\">(.*?)<\/td>/i",$inputStream,$sizeseedleech);
preg_match_all("/<td>((.*?)&nbsp;(.*?))<\/td>/i",$inputStream,$uploaded);
I would like to combine these arrays into one multi dimensional array.
$cleanArray[index][badarrayattrib]

The even ugliest thing is the $sizeseedleech array since it pulls 3 values. If I wanted to print the contents of the arrays, I do this.

Code: Select all

for($i = 0; $i <= 29; $i++)
{
        echo $torrentlink[1][$i] . "<br>" . $torrentname[1][$i] . "<br>" . $sizeseedleech[1][($i*3)] .
        "<br>" . $sizeseedleech[1][($i*3)+1] . "<br>" . $sizeseedleech[1][($i*3)+2] .
        "<br>" . $uploaded[1][$i] ."<br><br>";
}
Any way that any of this code could be changed? I would then in the future like to pass the new array to a db.

Any help would be greatly appriciated! Thanks in advance.

Re: Merge Arrays (my ugly arrays)

Posted: Fri Feb 08, 2008 4:16 pm
by RobertGonzalez
What do the arrays look like originally and what do you want them to look like?