How to implement one line of JS code with php

has a line of js code, and now I want to change it to php. But I don"t know how to operate

related codes

    var t ="HAtE*sTG6XlgrI0k2y5FheTOoKzwf6RQdPMpHLzUWIY_";

    var _csrfCode;
    if (t) {
        for (var e = 5381, i = 0, o = t.length; i < o; i += 1)
            e += (e << 5) + t.charCodeAt(i);
        _csrfCode = 2147483647 & e
    } else
        _csrfCode = ""
        console.log(_csrfCode);

my PHP code is written

$t = "HAtE*sTG6XlgrI0k2y5FheTOoKzwf6RQdPMpHLzUWIY_";
function charCodeAt ($str, $index)
{

$char = mb_substr($str, $index, 1, "UTF-8");

if (mb_check_encoding($char, "UTF-8"))
{
    $ret = mb_convert_encoding($char, "UTF-32BE", "UTF-8");
    return hexdec(bin2hex($ret));
}
else
{
    return null;
}

}

$_ csrfCode = 0;

$e = 5381;

for ($I = 0; $I < strlen ($t); $i PP)
{

)
$e +=  $e << 5 + charCodeAt($t,$i) ;

}
$_ csrfCode = 2147483647 & $e;

echo $_ csrfCode;
? >

but the two results are different. It will be different on the other side of the offset. Exactly where it is, it is not known now

.
Jul.08,2021
Menu