function version_compare_replacement($version1, $version2, $operator = '')
 {
     if (function_exists('version_compare')) {
         // built into PHP v4.1.0+
         return version_compare($version1, $version2, $operator);
     }
     // The function first replaces _, - and + with a dot . in the version strings
     $version1 = strtr($version1, '_-+', '...');
     $version2 = strtr($version2, '_-+', '...');
     // and also inserts dots . before and after any non number so that for example '4.3.2RC1' becomes '4.3.2.RC.1'.
     // Then it splits the results like if you were using explode('.',$ver). Then it compares the parts starting from left to right.
     $version1 = eregi_replace('([0-9]+)([A-Z]+)([0-9]+)', '\\1.\\2.\\3', $version1);
     $version2 = eregi_replace('([0-9]+)([A-Z]+)([0-9]+)', '\\1.\\2.\\3', $version2);
     $parts1 = explode('.', $version1);
     $parts2 = explode('.', $version1);
     $parts_count = max(count($parts1), count($parts2));
     for ($i = 0; $i < $parts_count; $i++) {
         $comparison = phpthumb_functions::version_compare_replacement_sub($version1, $version2, $operator);
         if ($comparison != 0) {
             return $comparison;
         }
     }
     return 0;
 }