Skip to content

Instantly share code, notes, and snippets.

@raws
Last active December 21, 2015 05:49
Show Gist options
  • Save raws/6259682 to your computer and use it in GitHub Desktop.
Save raws/6259682 to your computer and use it in GitHub Desktop.
<?php
$file_names = array('GOPR1772.jpg', 'GOPR1955.jpg', 'IMG_2393.jpg',
'IMG_2393_big.jpg', 'national-seismic-trace.png', 'foo_BIG.jpg');
$filtered_file_names = array_filter($file_names, function($value) {
return stripos(strtolower($value), '_big.') === FALSE;
});
var_dump($filtered_file_names);
?>
$ php -f filter_file_names.php
array(4) {
[0]=>
string(12) "GOPR1772.jpg"
[1]=>
string(12) "GOPR1955.jpg"
[2]=>
string(12) "IMG_2393.jpg"
[4]=>
string(26) "national-seismic-trace.png"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment