Fake Email Generator Create Random Email Addresses From Files

This is just a fun little toy that happened while working on MySQL Automation.
The files used are first_names.txt, last_names.txt and domains.txt.
Reading random lines from the files in order creates the “Fake Email Address” and using [array_rand($variable)]; each email address is somewhat unique as I’m only using 80,000 names (give or take a few hundred).

All Files: fake-email-generator.zip


#!/bin/bash
$first_names = 'first_names.txt';
$last_names = 'last_names.txt';
$dom = 'domains.txt';

    $firstname = file($first_names);
    $fdata = $firstname[array_rand($firstname)];
    $first = $fdata;

        $lastname = file($last_names);
        $ldata = $lastname[array_rand($lastname)];
        $last = $ldata;

    $comd = file($dom);
    $edata = $comd[array_rand($comd)];
    $com = $edata;

        $first = preg_replace('/\s+/', '', $first);
        $first = strtolower($first);
        $last = preg_replace('/\s+/', '', $last);
        $last = strtolower($last);
        $com = preg_replace('/\s+/', '', $com);

    echo $first."@".$last.$com;]