etrader Posted February 20, 2011 Share Posted February 20, 2011 Linked image in html has the form of <a href="http://site.com/link.html"><img class="not important" src='imagelink.jpg' title="not important" alt="not important"/></a> How to write href and src into an array during a foreach? Quote Link to comment https://forums.phpfreaks.com/topic/228282-regex-to-get-src-together-with-href/ Share on other sites More sharing options...
lilnow Posted February 22, 2011 Share Posted February 22, 2011 This may not be exactly what you are looking for, but hope it helps: $array = your image array here $rowHtml = ""; foreach($array as $filename){ $rowHtml = $rowHtml . "<ul>"; $rowHtml = $rowHtml . "<li><a href=\"$filename\">$filename</a></li>"; $rowHtml = $rowHtml . "</ul>"; } print $rowHtml; Quote Link to comment https://forums.phpfreaks.com/topic/228282-regex-to-get-src-together-with-href/#findComment-1178042 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.