Return to Snippet

Revision: 42751
at March 10, 2011 03:49 by ajbatac


Initial Code
<?php
/*
A simple PHP function to obfuscate an email address. 
By: AJ Batac
URL: http://allanjosephbatac.com

Usage:
<?= show_email("[email protected]"); ?>
<?php show_email("[email protected]"); ?>
*/

function show_email($email) 
{
    $finished='';
	$count = strlen($email);
    for($i=0;$i<$count;$i++)
	{
    	$n = rand(0,1);
    	if($n)
		{
    		$finished.='&#x'.sprintf("%X",ord($email[$i])).';';
    	}
		else
    	{
			$finished.='&#'.ord($email[$i]).';';
		}
    }
    return $finished;
}
?>

Initial URL
http://allanjosephbatac.com

Initial Description
A simple PHP function to obfuscate an email address. 

Usage:
<?=>
<?php>

Initial Title
Obfuscate Emails

Initial Tags
email

Initial Language
PHP