Disemvoweling PHP Function

7th April 2009 - 1 minute read time

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. function disemvowel($string)
  2. {
  3. return str_replace(array('a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'), '', $string);
  4. }

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.

Comments

Permalink
Never seen this before, but is very interesting

Jamie Bicknell (Tue, 04/07/2009 - 15:11)

Permalink

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

Anonymous (Sun, 04/08/2012 - 22:33)

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

Phil (Wed, 06/26/2013 - 21:39)

Add new comment

The content of this field is kept private and will not be shown publicly.