I want to display the character codes of a string in php. But its output is null Answer You are trying to get all “bytes” of the unicode string. You need to use mb_strlen() to get the real length of the characters. Then, you need to use mb_substr() to get the right character. Output : See also all mb_* functions