Case insensitive string match
I have a form with image upload and I check the allowed file extensions using the following array:
Is there a way to express the values in above array in a case insensitive way so that "JPG", "Jpg" and "jpg" or "PNG", "Png" and "png" will all be accepted? I know I can add 6 more elements to the array to accomplish this but maybe there is a solution with preg_match() or other function that I can't think of.
$allowedExtensions = array('jpg', 'jpeg', 'gif', 'png');
Thanks for your ideas.