golif
  Home
 
 Hallo,

das ist meine seite








Create your own banner at mybannermaker.com!
Copy this code to your website to display this banner!
= pow($length, $stellen)) $stellen++; $string = ""; $i = 0; for($i=$stellen; $i>0; $i--) { $index = floor($int / pow($length, $i - 1)); $string .= $array[$index]; $int = $int - pow($length, $i - 1) * $index; } return $string; } /** * @name str2int($str, $codec, $error_reporting=true) * @description konvertiert einen string zurück zu einem integer * @parameter str: str - der zu konvertierende string * @parameter codec: str - codec für die konvertierung * @parameter error_reporting: bol - gibt bei ungültigem codec eine fehlermeldung aus */ function str2int($str, $codec, $error_reporting = true) { preg_match_all('/./', $codec, $array); $array = $array[0]; if(count($array) < 2){ if($error_reporting) echo " n[b]Str2int() error[/b]: $codec too short "; return 0; } if(!str_replace($array, "", $str)==""){ if($error_reporting) echo " n[b]Str2int() error[/b]: signs of $str and $codec doesn't match "; return 0; } $strlength = strlen($str); $length = count($array); $int = 0; for($i=0; $i<$strlength; $i++) { $int += array_search(substr($str, $i, 1), $array) * (pow($length, ($strlength - ($i + 1)))); } return $int; } # Codec $codec = "0123456789ABCDEF"; // enspricht Hexadezimal # Werte zum Test $test[] = "255"; $test[] = "11259375"; echo "
using codec: [b]$codec[/b]nn"; 

# Werte konvertieren und zurück 
foreach($test as $int) { 
    # Konvertieren von $int 
    $tmp1 = int2str($int, $codec); 
    # Zurückkonvertieren von $tmp1 
    $tmp2 = str2int($tmp1, $codec); 
    # Ausgabe     
    echo "[b]$int[/b] ----> [b]$tmp1[/b] ----> [b]$tmp2[/b]n"; 
} 

?>
 
  Copyright  
 
Diese Webseite wurde kostenlos mit Homepage-Baukasten.de erstellt. Willst du auch eine eigene Webseite?
Gratis anmelden