1

I am working on a php code as shown below which prints H

echo substr("Hello world",0, 1);

Now, I have an accented Ĥ in Ĥello. The following code prints �.

echo substr("Ĥello world",0, 1);

Problem Statement:

I am wondering what changes I should make in the second echo statement above with Ĥello world as the string so that it prints H instead of .

Note: I want the second echo statement to return H not Ĥ. Only H

I have used the following code but it seems to return Ĥ not H

echo mb_substr("Ĥello world",0, 1);

flash
  • 1,455
  • 11
  • 61
  • 132

0 Answers0