Moderators Dragos Posted August 29, 2017 Moderators Report Posted August 29, 2017 (edited) Gmail oferă posibilitatea de a avea adresa personală cu punct sau fără (mai multe info aici). Prin scriptul următor se pot genera toate combinaţiile posibile pentru un ID dat. <?php /* Generate all combinations for a gmail username Author: Dragos <dragos@interinfo.ro> */ $input = "person"; $emails = generate_gmail($input); foreach($emails as $email) echo $email . "\n"; function generate_gmail($string) { $chars = str_split($string); $input = array(); for($i=0;$i<count($chars)-1;$i++) $input[] = array($chars[$i], $chars[$i] . "."); $input[] = array($chars[count($chars)-1]); $result = array(); foreach ($input as $key => $values) { if (empty($values)) continue; if (empty($result)) { foreach($values as $value) $result[] = array($key => $value); }else{ $append = array(); foreach($result as &$product) { $product[$key] = array_shift($values); $copy = $product; foreach($values as $item) { $copy[$key] = $item; $append[] = $copy; } array_unshift($values, $product[$key]); } $result = array_merge($result, $append); } } $final = array(); foreach($result as $res) $final[] = implode("",$res) . "@gmail.com"; return $final; } Edited August 29, 2017 by Dragos 5 Quote
Wav3 Posted September 1, 2017 Report Posted September 1, 2017 N-am testat codul, dar niste spatii si niste acolade ar fi foarte bine venite. Quote