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? 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; 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
Archived
This topic is now archived and is closed to further replies.