Making one array result call another array
I've got one array that may contain numbers in non consecutive order:
mainindex=array(1,2,4,8,10,7);
and a variable number of other arrays, each element of which is a url and a name:
m1=array('bizshop.com','Bizshop');
m2=array('hardtofindbooks.com','Bookstore');
m3=array('webmasterbiz.com','Webmasters');
etc.
I need to read the url from each array ONLY if it's number appears in the mainindex array. In the example above, the url from m3 would be skipped since 3 is not in mainindex.
I've tried foreach and can get a display of the variable I want:
foreach($mainindex as $ind){
$URLTry= '$m'."$ind".'[0]';
echo "$URLTry";
}
will show me
$m1[0];
and the rest
If I just have
echo "$m1[0]";
I see bizshop.com
and the other urls