List

Try: ca/tecreations/ViewFile.php -- Online


<html>
    <head>
        <meta charset="UTF-8">
        <style>
            td {
                min-width: 40; 
            }
        </style>
    </head>

    <body>
<p>
<?php

$z = $_REQUEST['z'];
if ($z == '') $z = "0";

$a = $_REQUEST['a'];
if ($a == '') $a = "0"; 

$b = $_REQUEST['b'];
if ($b == '') $b = "0";

GLOBAL $METHOD;
$METHOD = $_REQUEST['method'];
if ($METHOD == '') $METHOD = "decimal";

function decrementHex($hex) {
    if ($hex == "10") return "F";
    if ($hex == 0) return "F";
    if ($hex == 1) return "0";
    if ($hex == 2) return "1";
    if ($hex == 3) return "2";
    if ($hex == 4) return "3";
    if ($hex == 5) return "4";
    if ($hex == 6) return "5";
    if ($hex == 7) return "6";
    if ($hex == 8) return "7";
    if ($hex == 9) return "8";
    if ($hex == 10) return "9";
    if ($hex == 11) return "A";
    if ($hex == 12) return "B";
    if ($hex == 13) return "C";
    if ($hex == 14) return "D";
    if ($hex == 15) return "E";
}

function incrementHex($hex) {
    if ($hex == 16) return "10";
    if ($hex == 0) return "1";
    if ($hex == 1) return "2";
    if ($hex == 2) return "3";
    if ($hex == 3) return "4";
    if ($hex == 4) return "5";
    if ($hex == 5) return "6";
    if ($hex == 6) return "7";
    if ($hex == 7) return "8";
    if ($hex == 8) return "9";
    if ($hex == 9) return "A";
    if ($hex == 10) return "B";
    if ($hex == 11) return "C";
    if ($hex == 12) return "D";
    if ($hex == 13) return "E";
    if ($hex == 14) return "F";
    if ($hex == 15) return "0";
}

function toDecimal($hex) {
    if ($hex == "10") return 16;
    if ($hex == "F") return 15;
    if ($hex == "E") return 14;
    if ($hex == "D") return 13;
    if ($hex == "C") return 12;
    if ($hex == "B") return 11;
    if ($hex == "A") return 10;
    if ($hex == "9") return 9;
    if ($hex == "8") return 8;
    if ($hex == "7") return 7;
    if ($hex == "6") return 6;
    if ($hex == "5") return 5;
    if ($hex == "4") return 4;
    if ($hex == "3") return 3;
    if ($hex == "2") return 2;
    if ($hex == "1") return 1;
    if ($hex == "0") return 0;
    if ($hex == "") return 0;
}

function toHex($i = "") {
    if ($i >= 0 && $i <= 9) return $i;
    if ($i == 10) return "A";
    if ($i == 11) return "B";
    if ($i == 12) return "C";
    if ($i == 13) return "D";
    if ($i == 14) return "E";
    if ($i == 15) return "F";
    if ($i == 16) return "10";
}

function toUnicode($str = "") {
    return mb_chr($str);
}

function getNext($target) {
    if ($target == "10") return 0;
    if ($target == "0") return "1";
    if ($target == "1") return "2";
    if ($target == "2") return "3";
    if ($target == "3") return "4";
    if ($target == "4") return "5";
    if ($target == "5") return "6";
    if ($target == "6") return "7";
    if ($target == "7") return "8";
    if ($target == "8") return "9";
    if ($target == "9") return "A";
    if ($target == "A") return "B";
    if ($target == "B") return "C";
    if ($target == "C") return "D";
    if ($target == "D") return "E";
    if ($target == "E") return "F";
    if ($target == "F") return "0";
}

function getPrevious($target) {
    if ($target == "10") return "F";
    if ($target == "F") return "E";
    if ($target == "E") return "D";
    if ($target == "D") return "C";
    if ($target == "C") return "B";
    if ($target == "B") return "A";
    if ($target == "A") return "9";
    if ($target == "9") return "8";
    if ($target == "8") return "7";
    if ($target == "7") return "6";
    if ($target == "6") return "5";
    if ($target == "5") return "4";
    if ($target == "4") return "3";
    if ($target == "3") return "2";
    if ($target == "2") return "1";
    if ($target == "1") return "0";
    if ($target == "0") return "F";
}

function decrement($z = "0", $a = "0", $b = "0") {
    global $METHOD;
    $b = getPrevious($b);
    if ($b == "F") {
        $a = getPrevious($a);
        if ($a == "F") {
            if ($z == "0") {
                $z = "10";
            } else if ($z == "10") {
                $z = "F";
            } else {
                $z = getPrevious($z);
            }
        } 
    }
    return "z=$z&a=$a&b=$b&method=$METHOD";
}

function decrementA($z = "0", $a = "0", $b = "0") {
    global $METHOD;
    $a = getPrevious($a);
    return "z=$z&a=$a&b=$b&method=$METHOD";
}

function decrementB($z = "0", $a = "0", $b = "0") {
    global $METHOD;
    $b = getPrevious($b);
    return "z=$z&a=$a&b=$b&method=$METHOD";
}

function decrementZ($z = "0", $a = "0", $b = "0") {
    global $METHOD;
    if ($z == "0") {
        $z = "10";
    } else if ($z == "10") {
        $z = "F";
    } else {
        $z = getPrevious($z);
    }
    return "z=$z&a=$a&b=$b&method=$METHOD";
}

function increment($z = "0", $a = "0", $b = "0") {
    global $METHOD;
    $b = getNext($b);
    if ($b == "0") {
        $a = getNext($a);
        if ($a == "0") {
            if ($z == "F") {
                $z = "10";
            } else if ($z == "10") {
               $z = "0";
            } else {
                $z = getNext($z);
            }
        }
    }
    return "z=$z&a=$a&b=$b&method=$METHOD";
}

function incrementA($z = "0", $a = "0", $b = "0") {
    global $METHOD;
    $a = getNext($a);
    return "z=$z&a=$a&b=$b&method=$METHOD";
}

function incrementB($z = "0", $a = "0", $b = "0") {
    global $METHOD;
    $b = getNext($b);
    return "z=$z&a=$a&b=$b&method=$METHOD";
}

function incrementZ($z = "0", $a = "0", $b = "0") {
    global $METHOD;
    if ($z == "F") {
        $z = "10";
    } else if ($z == "10") {
        $z = "0";
    } else {
        $z = getNext($z);
    }
    return "z=$z&a=$a&b=$b&method=$METHOD";
}

?>
<?php
    global $METHOD;
    $prev = "/ca/tecreations/UnicodeTest2.php?" . decrement($z, $a, $b);
    $next = "/ca/tecreations/UnicodeTest2.php?" . increment($z, $a, $b);

  $Z = "";             
  $A = "";
  $B = "";


print("Z: "); 
for($i = 0; $i < 16; $i++) {
  $link = "<a href='/ca/tecreations/UnicodeTest2.php?z=" . toHex($i) . "&a=$a&b=$b&method=$METHOD'>" . toHex($i) . "</a>";
  echo $link . "&nbsp;&nbsp;"; 
}
  $link = "<a href='/ca/tecreations/UnicodeTest2.php?z=10&a=$a&b=$b&method=$METHOD'>10</a>";
  echo $link;

echo "<br />\n";

print("A: "); 
for($i = 0; $i < 16; $i++) {
  $link = "<a href='/ca/tecreations/UnicodeTest2.php?z=$z&a=" . toHex($i) . "&b=$b&method=$METHOD'>" . toHex($i) . "</a>";
  echo $link . "&nbsp;&nbsp;";
}
echo "<br />";

print("B: "); 
for($i = 0; $i < 16; $i++) {
  $link = "<a href='/ca/tecreations/UnicodeTest2.php?z=$z&a=$a&b=" . toHex($i) . "&method=$METHOD'>" . toHex($i) . "</a>";
  echo $link . "&nbsp;&nbsp;"; 
}
echo "<br />";

?>
<br />
<a href="<?php echo $prev; ?>">Previous</a> ::
    <?php
        global $METHOD;
        echo "<a href='/ca/tecreations/UnicodeTest2.php?" . decrementZ($z,$a,$b) . "'>Z</a>";
    ?>
 : 
    <?php
        global $METHOD;
        echo "<a href='/ca/tecreations/UnicodeTest2.php?" . decrementA($z,$a,$b) . "'>A</a>";
    ?>
 : 
    <?php
        global $METHOD;
        echo "<a href='/ca/tecreations/UnicodeTest2.php?" . decrementB($z,$a,$b) . "'>B</a>";
    ?>

-- <a href="<?php echo $next; ?>">Next</a> ::
    <?php
        global $METHOD;
        echo "<a href='/ca/tecreations/UnicodeTest2.php?" . incrementZ($z,$a,$b) . "'>Z</a>";
    ?>
 : 
    <?php
        global $METHOD;
        echo "<a href='/ca/tecreations/UnicodeTest2.php?" . incrementA($z,$a,$b) . "'>A</a>";
    ?>
 :  
    <?php
        global $METHOD;
        echo "<a href='/ca/tecreations/UnicodeTest2.php?" . incrementB($z,$a,$b) . "'>B</a>";
    ?>

<br />
<hr />
<?php
    global $METHOD;
    $line = "";
    if ($z == "10") $zDec = 16 * 256 * 256;
    else $zDec = toDecimal($z) * 65536;
    echo "$" . "zDec: $zDec<br />";
    echo "&amp;#" . $z . $a . $b . "xx;";
    echo "<hr />";

    echo "Method: " . 
         "<a href='/ca/tecreations/UnicodeTest2.php?z=$z&a=$a&b=$b&method=mb_chr'>mb_chr()</a>&nbsp;&nbsp;" . 
         "<a href='/ca/tecreations/UnicodeTest2.php?z=$z&a=$a&b=$b&method=entity'>Entity (Hex)</a>&nbsp;&nbsp;" . 
         "<a href='/ca/tecreations/UnicodeTest2.php?z=$z&a=$a&b=$b&method=decimal'>Entity (Decimal)</a>&nbsp;&nbsp;" . 
         "<a href='/ca/tecreations/UnicodeTest2.php?z=$z&a=$a&b=$b&method=decimalBOLD'>BOLD (Decimal)</a>&nbsp;&nbsp;" . 

        
         "<br />";
    echo "<hr />"; 
    echo "<table colspan='17' rowspan='16'>\n"; 
    echo "<thead>\n";
    echo "    <td>C</td>";
    echo "    <td>D-0</td>";
    echo "    <td>D-1</td>";
    echo "    <td>D-2</td>";
    echo "    <td>D-3</td>";
    echo "    <td>D-4</td>";
    echo "    <td>D-5</td>";
    echo "    <td>D-6</td>";
    echo "    <td>D-7</td>";
    echo "    <td>D-8</td>";
    echo "    <td>D-9</td>";
    echo "    <td>D-A</td>";
    echo "    <td>D-B</td>";
    echo "    <td>D-C</td>";
    echo "    <td>D-D</td>";
    echo "    <td>D-E</td>";
    echo "    <td>D-F</td>\n";
    echo "</thead>\n";

    for($c = 0; $c < 16; $c++) {
        echo "<tr>\n";
        echo "    <td>";
        echo "         <b>" . toHex($c) . ":</b> ";
        echo "    </td>";
        for($d = 0; $d < 16; $d++) {
            echo "    <td align='center'>";
            if ($METHOD == "mb_chr") {
                echo mb_chr( $zDec + ($a * 256 * 16) + ($b * 256) + ($c * 16) + $d, 'UTF-8');
            } else if ($METHOD == "entity") {
                echo "&#" . $z . $a . $b . $c . $d;
            } else if ($METHOD == "decimal") {
                echo "&#" . ($zDec + (toDecimal($a) * 16 * 256) + (toDecimal($b) * 256) + (toDecimal($c) * 16) + toDecimal($d));
            } else if ($METHOD == "decimalBOLD") {
                echo "&#" . ($zDec + (toDecimal($a) * 16 * 256) + (toDecimal($b) * 256) + (toDecimal($c) * 16) + toDecimal($d));
            }
            echo "    </td>\n";
        }
        echo "</tr>\n";
    }
    echo "</table>";
    echo "<hr />";
?>
    </body>
</html>