Try this
$some_strings = array();
foreach($files as $key=>$value)
{
if(strstr($value,'some-string')){
$some_strings[] = $files[$key];
unset($files[$key]);
} elseif (strstr($value, 'php')) {
unset($files[$key]);
}
}
//Now you can use $some_strings here without a problem