The principle of converting long links to short links

long link to short link code:

    <?php
    function short_url($input = "", $salt = "") {
        $base62 = array ("a", "b", "c", "d", "e", "f", "g", "h","i", "j", "k", "l", "m", "n", "o", "p","q", "r", "s", "t", "u", "v", "w", "x","y", "z", "0", "1", "2", "3", "4", "5","6", "7", "8", "9", "A", "B", "C", "D","E", "F", "G", "H", "I", "J", "K", "L", 
    "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" );
    
        $hex = md5($input . $salt);
        $hex_length = strlen($hex);
        $sub_hex_length = $hex_length / 8;
        
        $output = array();
        for ($i = 0; $i < $sub_hex_length; $iPP) {
             $sub_hex = substr($hex, $i * 8, 8);
             $int = 0x3FFFFFFF & (1 * ("0x" . $sub_hex));
             $out = "";
             for ($j = 0; $j < 5; $jPP) {
                $val = 0x0000003F & $int;
                $val = $val % 62; 
                $out .= $base62[$val];
                $int = $int >> 6;
            }
            $output[] = $out;
        }
        
        $in = 0x3 & (1 * ("0x".substr($hex, 0, 1)));
        
        return $output[$in];
    }
    

Why do you use bit operations in the second for loop? And is 0x0000003F .

Php
Mar.14,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b324bc-2bdf4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b324bc-2bdf4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?