Hi!
I have a bunch of text and HTML and what I want to achieve is gather all css classes of img tags that match a certain pattern and place them in a loop.
For example:
<img src="sample1.gif' class="get-this-tag-1" />This is text. This is text. This is text. This is text. This is text. This is text. <img src="sample2.gif' class="image" />This is text. This is text. This is text. This is text. This is text. This is text. <img src="sample3.gif' class="get-this-tag-2" />This is text. This is text. This is text. This is text. This is text. This is text.
In the sample we have 3 images with different classes: get-this-tag-1, image and get-this-tag-2. I only want to retrieve the classes that match get-this-tag- and have them in a loop.
foreach ($classes as $class) {
//do something
}
Is this possible? Or is there a more optimal way of doing what I want to achieve?
Thank you in advance!