Disemvoweling PHP Function

×

Error message

Warning: apc_store(): Potential cache slam averted for key 'www.hashbangcode.com::cache_bootstrap::variables' in DrupalAPCCache->set() (line 206 of /var/www/www.hashbangcode.com/2014-03-22-2105/docroot/sites/all/modules/contrib/apc/drupal_apc_cache.inc).

Tuesday, April 7, 2009 - 10:01

Disemvoweling is a technique used on blogs and forums to censor any post or comment that contains spam or other unwanted text. It involves simply removing the vowels from the text so that it is almost, but not entirely, unreadable.

Use the following function to disemvowel a string of text.

1
2
3
4
function disemvowel($string)
{
    return str_replace(array('a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'), '', $string);
}

As an example, the first sentence on this post:

Disemvoweling is a technique used on blogs and forums to censor any post or comment that contains spam or other unwanted text.

would appear like this:

Dsmvwlng s tchnq sd n blgs nd frms t cnsr ny pst r cmmnt tht cntns spm r thr nwntd txt.

Which doesn't make a lot of sense, but is still kind of readable. This technique kills unwanted comments without removing the text entirely.

Check out the Wikipedia page on Disemvoweling for more information on the origins or this method.

Category: 
philipnorton42's picture

Philip Norton

Phil is the founder and administrator of #! code and is an IT professional working in the North West of the UK.
Google+ | Twitter

Comments

how do u disemvowel someone's comment like say facebook. It's a perfect argument ender.

Nice tool. Wonder if it would make sense to only apply the replacement to words that are larger than 3 characters.

Add new comment