Two foreach loops, ideea for my code please
Posted
by
webmasters
on Stack Overflow
See other posts from Stack Overflow
or by webmasters
Published on 2010-12-23T10:38:13Z
Indexed on
2010/12/23
10:54 UTC
Read the original article
Hit count: 203
Please give me an ideea for my code, its a simple links script. TY I need two foreach loops, one which loops my sites and one which loops my anchors. So i'll have
<li>link to site1 and anchor to site1</li>
<li>link to site2 and anchor to site2</li>
<li>link to site3 and anchor to site3</li>
$currentsite = ''.bloginfo('wpurl').'';
$mysites = array('http://site1.com', 'http://site2.com', 'http://site3.com');
$myanchors = array('anchor1','anchor2','anchor3');
foreach($mysites as $mysite) ****** i need a foreach loop for the anchors array *******
{
if ( $mysite !== $currentsite ){echo '<li><a href="'.$mysite.'" title="'.$myanchor.'">'.$myanchor.'</a></li>';}
}
© Stack Overflow or respective owner