插入不规则,为什么我的代码不起作用?

When I want to get a letter from Ascii Code and get a number with a number like 8 and I'll get back to it, I'm having trouble, the answer is not printed correctly. For example, I run the following code:

$a = "Milk";

for ($i = 0; $i < 4 ;$i++) {

  echo ord($a[$i]) . " + " . 8 . " = " . (ord($a[$i]) + 8) . "<br>";
  $a[$i] = ord($a[$i]) + 8;
  echo "$a[$i]";
}

The answer is as follows:

77 + 8 = 85
8105 + 8 = 113
1108 + 8 = 116
1107 + 8 = 115
1

How can I solve this problem?

Try using intval(ord($a[$i])) to turn the type from string to int.