php anchor email link code example

Example: php anchor email link

//Prevents robots to detect emails

function anchorMailto($email) {
	$output='<script type="text/javascript">';
    $output.="var asdfkjl1=[";
   
    for($i=0;$i<strlen($email);$i++){
        $output.= ord(substr($email,$i,1)).",";
    }
    
    $output = substr($output, 0, -1); 
    $output.= "]";
    
    $output.="
    var newName='';
    for (var i=0; i<asdfkjl1.length; i++)
     newName+=String.fromCharCode(asdfkjl1[i])
    document.write('<a href=\"mailto:'+newName+'\">'+newName+'</a>')
    </script>";
    
    return $output;
}

Tags:

Php Example