Register now or log in to join your professional community.
string str = "astr"; string lastChar=str.Substring(str.Length -1,1));
There are3 ways:
1) Reverse the string, store it in another string, read the first character of this new reversed string.
2) Print the (size-1) index of the string array, ie. str[size-1] (assuming, array index starts from0).
3) Use a combination of PHP end() and key() functions to achieve the same.