Per il tuo specifico problema, potresti anche usare questo codice:

codice:
<?php
$variabile = "oms";
$nomi = array (
"tommaso" => "m",
"nicla" => "f",
"silvestro" => "m",
"gina" => "f",
"nemo" => "m",
"carol" => "f",
"elenoire" => "f"
);

foreach ($nomi as $key=>$value)
{
preg_match_all("@(o|m|s)@", $key, $mtc);
$mtc = $mtc[0];
if (count($mtc) > 0) echo "trovato ".$key."";
}
?>