anonymize emails texts names

Started on the old forum in July 2012 · view the original in the archive · old links redirect here

No replies · 1,611 views · started 14 years ago · 1 min read

GumSlone Administrator Principal · 1,690 posts #1

this function anonymizes emails and names etc

<?php
function anonymize($text='',$char_num=3)
{
	for($i==0;$i<strlen($text);$i++)
	{
		if(($i % $char_num)==0&&ctype_alnum($text[$i]))
			$new_text .= '*';
		else
			$new_text .= $text[$i];
		
	}
	return $new_text;
}

?>

usage

$email = 'someemail@gmail.de';
echo anonymize($email,4);

output:

*ome*mai*@gm*il.*e

Advertise your mobile site for FREE with AdTwirl

External image (may be gone)

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close