<?php
$dic = file('test.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
$word = 'mama';
$arr_word = preg_split("##", $word, -1, PREG_SPLIT_NO_EMPTY);
foreach($dic as $line)
{
$arr_line = preg_split("##", $line, -1, PREG_SPLIT_NO_EMPTY);
if(count($arr_word) == count($arr_line))
if(!array_diff($arr_line, $arr_word))
echo 'yes: '.$line.'<br />';
}
?>
ищем
mama
файл
mama
amma
ammam
aja
ammah
assa
mmaa
aamm
Результатyes: mama
yes: amma
yes: mmaa
yes: aamm
_____________
HTML, CSS (Bootstrap), JS(JQuery, ExtJS), PHP, MySQL, MSSql, Posgres, (TSql, BI OLAP, MDX), Mongo, Git, SVN, CodeIgnater, Symfony, Yii 2, JiRA, Redmine, Bitbucket, Composer, Rabbit MQ, Amazon (SQS, S3, Transcribe), Docker