= 0; $pos--) { //current position represents floor($int / ($base64charsLength ^ $pos)) $base = 1; for($i = 0; $i < $pos; $i++) { $base = $base * self::$base64charsLength; } $posValue = floor($int / $base); //get the char representing $posValue $posChar = self::$base64chars[$posValue]; $numeric .= $posChar; } return $numeric; } public static function numToInt($numeric) { $base = 1; $int = 0; for($pos = strlen($numeric)-1; $pos >= 0; $pos--) { $posValue = array_search($numeric[$pos], self::$base64chars); $int = ($posValue * $base); $base = $base * self::$base64charsLength; } //fix a small "bug": normaly 0 = AAAAA but we need 1 = AAAAA $int = $int + 1; return $int; } } ?>