php bin2hex sorun

0 Cevap php

I Wrote a small php script to convert string to HEX but i have a problem or i missed something , Here is a small test :

$char='だ';
$a='a';
echo $char,':', bin2hex($char),"\n";
echo $a,':', bin2hex($a),"\n";

The result i get for the 'a' (or any ASCII) is correct but for Chinese or Hebrew or Arabic are not correct Here is the output:

だ:e381a0
a:61

What is this long number the HEX for this char(だ) from charmap tool is 3060 but why i get wrong values from PHP.

Teşekkürler.

0 Cevap