Because string indexing works like array indexing - it starts from 0. This means everything you'd count normally is actually 1 less. Like this:
String: P H P
Index: 0 1 2
strlen() gets the length of the string, so it's literally just counting how many characters there are, so you need to -1.