I want to be able to trim a string where values match an array like this
$image_formats = array('.png','.jpg', '.jpeg', '.gif');
$file = 'image1.png';
$file_stripped = trim($file, $image_formats);
Wanted Result: 'image1'
Is there a function for this, whats the best method to go about achieving this?