أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.
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.