I want to convert a string like:
alnassre
will be 0061006c006e00610073007300720065
عربي
will be 063906310628064a
a
will be 0061
using PHP
as what is going in the link http://www.bareedsms.com/tools/UniCodeConverter.aspx
I want to convert a string like:
alnassre
will be 0061006c006e00610073007300720065
عربي
will be 063906310628064a
a
will be 0061
using PHP
as what is going in the link http://www.bareedsms.com/tools/UniCodeConverter.aspx
I know you already found an answer that works for you, but this should be:
Much faster
Much easier to adapt to other character encodings.
It does depend on iconv
, but all modern PHP installs have that, right?
function utf8_to_unicode_codepoints($text) {
return ''.implode(unpack('H*', iconv("UTF-8", "UCS-4BE", $text)));
}
I found the answer but it return array here
I Edit the function to return String.