I am looking for an algorithm in PHP to make output of all possibilities with dot. produces we can put do in any place of word but repeated two dots after each other is now
I found the solution eventually by helpful guidance of https://stackoverflow.com/users/844416/mbo:
function stringInsert($str,$insertstr,$pos){
$str = substr($str, 0, $pos) . $insertstr . substr($str, $pos);
return $str;
}
function generate($var="note",$i=0){
$length = strlen($var);
while ($i+1 < $length) {
$i++;
$new = stringInsert($var,'.',$i);
echo $new;
generate($new,$i+1);
}
}
generate('shaghayegh');
for example for keyword "note" generated 7 strings
for keyword "shaghayegh" generated 511 strings