Why substr() is behaving strangely?

There is a line $a = "room 14";
Why echo substr($a, 10); gives "Ghost 14" when should return "14"?
June 10th 19 at 15:27
1 answer
June 10th 19 at 15:29
Solution
If start is not negative, the returned string will start from the position start from the beginning of the string str, the initial character has the index 0. For example, in the string 'abcdef', the character at position 0 is 'a', the character in position 2 - 'c' etc.


Here's a question actually that I have passed 10 and it returns me substring Bud to I 5 handed. - jaylon_Hahn74 commented on June 10th 19 at 15:32
In Russian encoding one character occupies two bytes. Cut 10, the first byte is cut off 5 characters. - Giles_Luettgen18 commented on June 10th 19 at 15:35
And everyone understood, this feature is already encoding it is necessary to transfer, Chet didn't notice the difference between them - jaylon_Hahn74 commented on June 10th 19 at 15:38

Find more questions by tags PHP