Can someone pls explain me why does the following code prints "t"?
$a = "print";
Because you can treat a string sort of like an array of characters, and since it's a zeroth based array, index 4 is the 5th character.
This is because you are using array. array means it starts from '0' and then continue till '4' which total is '5' numbers. So the in word "print" it will count form '0' and will print the 5th character as in the array you have mentioned .
Hope your problem is solved.