Knowledge Base

¿Qué es esto?

PHP: Ofuscar direcciones de e-mail

25/11/2015 - 18/12/2018 -  Comentarios - PHP

Para ofuscar una dirección de e-mail reemplazando los caracteres por su versión HTML podemos utilizar esta función:

# This function does the actual obfuscation

function textObfuscator( $text ) {

        $output = "";

        for( $i=0; $i<strlen($text); $i++ ){

                // Convert each character in the string to its equivalent ASCII code..

                $output .= "&#". ord(substr($text, $i, 1)) .";";

        }

        // Return the obfuscated string..

        return $output;

}

Sacado de aquí: https://www.mediawiki.org/wiki/Extension:EmailObfuscator