I’m a real PHP novice, so please excuse any incorrect terminology :).
I’ve got some HTML code containing text and a set of a few images, where I need to isolate and return a small string containing a particular image.
I’ve cleaned up the HTML to remove all text and then inserted this data in to an array using explode().
One of the array variables has the text “main.jpg” in it and I need to return the whole array value. The image name is a set of random characters, but always has main.jpg somewhere in the name. I’ve looked up all sorts of methods, using preg_grep etc…, and I’m either doing it incorrectly or don’t know the correct function.
The question is, how can I check an array for a substring and then return the whole value?
Any help would be most welcome. I’ve been trying to get this coded for a few hours, but as I’m unfamiliar with PHP it’s a real challenge.