Example #1
0
 public static function decode($input)
 {
     if (!self::$ralphabet) {
         self::$ralphabet = array_flip(self::$alphabet);
     }
     $output = 0;
     $l = strlen($input);
     for ($n = 0; $n < $l; $n++) {
         $c = $input[$n];
         echo "c = {$c}, l = {$n}, output = {$output}\n";
         $output *= 32;
         if (isset(self::$ralphabet[$c])) {
             $output += self::$ralphabet[$c];
         } else {
             return false;
         }
     }
     echo "c = {$c}, l = {$l}, output = {$output}\n";
     return $output;
 }