Thanks guys, the second solution seems obviously better since it's pretty straightforward and I think it should allow me to look up not only extensions but also strings within the elements. You see, my example called for filtering file extensions but I was looking for something a bit more universal. I tried replacing the .php in the example with text that could be found in the filenames like so:
print_r(preg_grep ("/.php$/",$array)); ---->
print_r(preg_grep ("image",$array));
But this doesn'y work. I'm simply unsure about the syntax here.
If my array elements are as follows:
1_image, 2_image, 1_bigthing, 2_bigthing
How would I filter for only the elements containing the word "image" ?
Thanks again