I have some arrays and they might all be formatted like so:
Array (
[0] => .
[1] => ..
[2] => 151108-some_image-006.jpg
[3] => high
[4] => low
)
I know they have 5 values, but I can not be certain where each value is being placed.
I am trying to get only the image out of this array
$pos = array_search('*.jpg', $main_photo_directory);
echo $main_photo_directory[$pos];
But as we all know, it's looking for a literal *.jpg
which it can't find. I'm not so super at regex and wouldn't know how to format an appropriate string.
What is the best way to get the first image (assuming there may be more than one) out of this array?
ADDITION
One of the reasons I am asking is to find a simple way to search through an array. I do not know regex, though I'd like to use it. I wrote the question looking for a regex to find '.jpg' at the end of a string which no search results had yielded.