Levidrome News

Levidromes - Our Secret Sauce

Posted on
Levidrome List Secret Sauce

When we first started this website, we wanted to publish all known levidromes. We started with English, then expanded to other languages. We have achieved that goal for all the dictionary lists we have found.

We probably took the fun out of trying to find new levidromes. All you have to do is visit our list pages and there they are. But how did we find them?

A bit of a hint. When we created our FAQ page, we actually went through the process of how our levidrome finding script worked. But today, we are going to reveal the actual script. Our secret sauce in our finding levidromes recipe.

The script was developed in PHP, a programming language which is used highly in web environments. Wordpress, one of the the most popular Web development tools used today, is written in PHP.

Although highly used on the web, PHP is still a programming language which can take data as input and spit out results as output. I am very familiar with the language and it has a bunch of built in functions which handle arrays (or lists) beautifully.

To quote what we said on our FAQ page:

We extracted the words programmatically. We developed an app or script (in PHP) which does the necessary steps to create the lists. Essentially, we take the list of words, convert to UTF-8 (to standardize so non-english words will show properly on our website), change uppercase to lowercase, remove duplicates, then reverse each word and add it to the existing list. Any duplicates at that point will either be levidromes or palindromes. We remove the palindromes and are left with levidromes.

That was basically the procedure or method to our goal. The only pre-work which had to be done was to ensure the list of words was in UTF-8 format (which is a format which can display foreign characters). Our DICT words lists are already in this format.

Here is the script (using tagalog as an example):

function array_not_unique( $a = array() )
 return array_diff_key( $a , array_unique( $a ) );
function mb_strrev($string, $encoding = null) {
 if ($encoding === null) {
  $encoding = mb_detect_encoding($string);

$length = mb_strlen($string, $encoding);
$reversed = '';
while ($length-- > 0) {
  $reversed .= mb_substr($string, $length, 1, $encoding);

return $reversed;
foreach($uniq as $word){

So there you have it. Once the script is run, you will have 2 files, one with levidrome words and the other with palindrome words. The secret sauce or coding which we used to created our lists.

Aside note: Most instances of PHP by default do not have the MBSTRING functions enabled. You may need to add these features to your PHP install by either downloading the extensions, or enabled them in the php.ini file by uncommenting the extension=php_mbstring.dll line.

I apologize in advance. This was probably the most geeky post I have ever written for this website. However, that is me...geeky...but also a levidromist geek.