code.fastix.org

Dateiansicht:

Datei:Projekte -> PHP:Umrechnung zwischen Zahlensystemen -> test.php
md5:a0275645d80621ee08cf0593ae7ce116
sha1:a0c155770a5237ba613a68009817ece78ab67db8
Download-Link:Download
  1. <?php
  2. $startTime=microtime(1);
  3. require 'numberSystem.php';
  4. #$ns = new numberSystem('ascii_visible');  # Cyphers: 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
  5. #$ns = new numberSystem('ascii_33_126');   # Cyphers: $%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
  6. #$ns = new numberSystem('bin');            # Cyphers: 01
  7. #$ns = new numberSystem('AZKL10');         # Cyphers: AZKL10
  8. #$ns = new numberSystem('niceReadable32'); # Cyphers: 0123456789ABCDEFGJKLMNPRSTUVWXYZ
  9. #$ns = new numberSystem('AZKL10');         # Cyphers: AZKL10
  10. #$ns = new numberSystem('wuerfel');        # Cyphers: 0987123546
  11. $ns = new numberSystem(); # default = niceReadable32
  12.  
  13. for ($val=0; $val<1000000; $val++) {
  14.     $s = $ns -> getString($val);
  15. /*
  16.     $d = $ns -> getDec($s);
  17.     if ($val != $d) {
  18.         echo "$val\t$s\t$d\tERROR\n";
  19.     } else {
  20.         echo "$val\t$s\t$d\n";
  21.     }
  22. #*/
  23. }
  24. echo "TIME: ", microtime(1) - $startTime , "s\n";