<?php
/*
 * Author: Alberto Lepe (www.alepe.com)
 */
function PassGen($len=6) {
    
$passwd "";
    
$chars=array();
    
$vocales=array();
    for(
$i=97;$i<=122;$i++) {
        
array_push($charschr($i));
    }
    
array_push($vocales"a");
    
array_push($vocales"e");
    
array_push($vocales"i");
    
array_push($vocales"o");
    
array_push($vocales"u");
    for(
$i=0;$i<($len/2);$i++) {
        
mt_srand((double)microtime()*1000000);
        
$passwd .=$chars[mt_rand(0,count($chars)-1)];
        
$passwd .=$vocales[mt_rand(0,count($vocales)-1)];
    }
    return 
substr($passwd,0,$len);
}
function 
fake_email($email) {
    list(
$user,$host) = explode("@"$email);

    
$vararr=explode(".",$host);
    if(
count($vararr)>0){
        
$ext=$vararr[count($vararr)-1];
    }

    
$lnusr strlen($user);
    
$lnext strlen($ext);
    
$lnhost strlen($host)-$lnext-1;

    
$rows strlen($email);
    
$cols $rows;

    
$i 0//counter for email chars
    
for($row 0$row $rows$row++) {
        
$fk_email[$row]  = PassGen($lnusr)."@".PassGen($lnhost).".".fake_ext($lnext);
    }
    for(
$col 0$col $cols$col++) {
        
$fk_email[$col] = substr_replace($fk_email[$col], "<b>".$email[$col]."</b>"$col1);
    }
    return 
implode("\n",$fk_email);
}
function 
fake_ext($lnext) {
    
mt_srand((double)microtime()*1000000);
    
$ext2 = array("jp","mx","us","br","it","uk","kr","ca","de","es","ch","pe","tv");
    
$ext3 = array("com","net","biz","org","edu","gov");
    switch(
$lnext) {
        case 
2:
          
$fe $ext2[mt_rand(0,count($ext2)-1)];
        break;
        case 
3:
          
$fe $ext3[mt_rand(0,count($ext3)-1)];
        break;
        default:
          
$fe PassGen($lnext);
    }
    return 
$fe;
}
?>
<style type="text/css">
pre.fake {
    color: #DDD;
    border: 1px 000 solid;
    font-size: 15px;
    background-color: #CCC;
    width: 150px;
    text-align: center;
    border: 1px #000 solid;
    padding: 5px;
}
pre.fake b {
    color: #00F;
    font-weight: bold;
}
</style>
<?php
echo "<pre class='fake'>";
echo 
fake_email("me@host.com");
echo 
"</pre>";
?>