I'm retrieving all images in a section of my source code. I want it to skip all the images that have the id="blocker". I've tried using strpos to search for the id in the image src. I then try to skip the image with that id by using the 'continue' expression, but it's not working. I'm not too familiar with preg_match_all, so can someone see if they can get this to work for me. I'll be able to learn from it. Or if anyone has an easier script to do what I want, that would be even better. Thanks.
//retrieve all images within the above string
preg_match_all('#<img\s[^>]*src\s*=\s*[\'"]?([^\'"\s>]+)[\'"]?[\s>]#i', $matches[0], $images);
foreach($images[1] as $image)
{
$ider = 'id="blocker"';
$pos = strpos($image, $ider);
aha, you made me realize that I'm just pulling the source of the image and not the whole image tag. Thats why it can't read if there is an id. Can you alter my regular expression so it pulls the whole image tag instead of just the source? I'm trying to learn regular expressions, but they just make my head hurt at this point. thanks.
Bookmarks