How can I trim the img tag ONLY off a content? This is the code i tried but doesnt work...
Code: Select all
<?php
$source = '<img src="pic1.jpg"/><a href="link1.html">Duis autem </a> vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, <img src="pic2.jpg"/>vel illum dolore eu <a href="link1.html">feugiat</a> nulla facilisis ...';
$trimmed = trim($source, '/<img src="([^>]*)"\/>/si');
echo $trimmed;
?>Lau