get the last character of a string in php

Solutions on MaxInterview for get the last character of a string in php by the best coders in the world

showing results for - "get the last character of a string in php"
Emilie
28 Oct 2017
1substr("testers", -1); // returns "s"
Emelie
06 Mar 2016
1phpCopy<?php  
2$string = "This is a string";
3
4$lastChar = $string[-1];
5echo "The last char of the string is $lastChar.";
6?>
7
Bilel
13 Mar 2016
1phpCopy<?php  
2$string = 'This is a string';
3$lastChar = substr($string, -1);
4echo "The last char of the string is $lastChar.";
5?>
6
Maxence
20 Jan 2019
1phpCopy<?php  
2$string = "This is a string";
3$lengthOfString = strlen($string);
4$lastCharPosition = $lengthOfString-1;
5$lastChar = $string[$lastCharPosition];
6echo "The last char of the string is $lastChar.";
7?>
8
Jago
01 Jun 2020
1phpCopy<?php 
2$string = "This is a string";
3$lastCharPosition = strlen($string) - 1;  
4for ($x = $lastCharPosition; $x < strlen($string); $x++) {
5    $newString = $string[$x]; 
6} 
7echo "The last char of the string is $newString.";
8?> 
9
Emil
20 Sep 2018
1phpCopysubstr($stringName, $startingPosition, $lengthOfSubstring);
2
queries leading to this page
string last value get in phpget last 7th character from last phpget last characters name phpget only last character of string phpexplode string and get first letter of first indexphp exclde last 4 characters from stringget last caracter phpget last 3 digits of string phpphp last characters of stringphp get last letter from stringphp substring get last characterphp find last strposphp get last part of a stringphp substring last characterphp check last character of substringphp check last character in stringphp string last n charactersphp check the last character of a stringstrchr last character phpphp last 9 letter of stringfind the last lette in a string phpsubstring in phpphp string get last charcterget last letter of stringphpphp get string behind the last charactercheck last 3 character in string phpfind position of last element in string phphow to find str position is last in phphow to get last word from the string in phphow to get the last character of a string in php 3fget last 4 characters string phpphp get last letters of stringphp get last index of stringget last 32 char phpphp last position of character in stringhow to cut number string phpphp get last characters on wordstr last value in phpget last string in phpfind last character in string phpsubstr php variable 26php string last characterget last word from string in phplast char string phpsub string function index of in phpget the last caracter of the srintg phpphp detect last string caracterphp get last characterslast 4 char of string phpget last character of string laravelget last 2 characters of string phpphp take last two character of stringget last n character of string phplast char check in string phplast position string phpget last string until 2f phplast index of string phpget everything before the last character phpget last 3 characters of string phpget the last string in phpget last string before phpphp print last character from stringhow to check last character of a string in phpread last string in phpphp get the last character of a stringphp get last string characterphp get last digit substrget last 4 characters of string phpphp substrget last string after 2f in phpphp find the last number of a string posphp substring from last charactersplit first letter phpget last character string phpphp get last 2 characters stringget last character of string phhow to get the last character of a string in php 3f 285 pts 29php get last charactersubstr last characters phphow do i grab last number in a string in php 3flast characters string phpphp check last characters of stringget last letter in phpphp string last elementphp find last occurrence in stringlast char phphow to get last word of string in phpget last word from the string in phpphp get last char of stringget first last character phpphp substr get last charphp last part of a stringget the last value of a string in phpsubstr in phpget last character from url string phpphp get second last character of stringphp get last 3 character of a stringphp get substring from last 2fget 5 last character of string phpphp get last part of stringget the last fourth character from a string phpget last word from string of phphow substring in string in phpget string last position phpcut a data from string phpget the last 3 chars in phphow to check last element of string in phpphp strpos last occurrencephp substring last 3 charactersphp get first and last character of stringget last character of string after specific phpphp find last character in stringphp get last 3 charahow to get last character of string in phplast word from string in phpphp find last instance of character in stringmatch last 4 char phpphp read the last charactersphp substr from last characterphp get the last x char of a sentencephp get last 6 characters in stringphp get last word in stringphp last character of stringget last three characters of string phphow to get last few characters from a string in phphow to get the last letter of each word in a string phpget last string phpphp get last stringphp find last index of stringphp check last character is a numberphp get last 5 letters of stringphp get last character of string stringphp extract last word from stringphp last certaint character of stringphp take last character of stringphp last string charcheck the last character of a string phpphp get last 4 character of stringpph string last 5cphp last char in stringphp index of last character in stringphp echo lastt 10 characters of a stringget last word from string phphow to get last 2 single char from given string using phplast cchar phpphp get last character of stringcheck string last character phpphp get first and last name from stringget last i digit from string in phpphp get first letter of stringphp string last 3 characterslast char php variablephp how to get last character of stringslice last char of string phpphp string before last characterhow to get the last part of the string in phplast of string phpget last 2f from string phpcheck what last character in string is phpget last x characters from string phpget last 4 character in phpphp get last numbers from stringphp last charcterphp last index of character in stringphp get last two chartget last 10 characters of a string in phpdisplay last 4 characters in phpphp get last wordphp get string except last characterphp get last n chars of stringphp get last number of stringphp last part of stringphp last letterphp last 4 characters of stringphp test last character of stringlast char of a string phpget last occurrence string phplast letter phplast 3 characters of string phpget last two characters of string phpsbstr last digits phpget last string after last underscore phpphp substr last characterphp get last part of string by characterphp take last 4 charactersphp string check last characterhow to get string last character in phpget the last number from string phpget last letters from string phpget last part of a string phptake last five characters in a string in phpget last 10 characters string phpphp last 7 characters of stringsubstr php show only last 4 characterphp last chars ofa stringphp get last 2 characters of stringget last 3 letters of string phpget last 10 characters from string phpget last 5 character from string phpphp last char indexselect last 5 number in an string phpin text get last string phpphp get last integer from stringphp get string last characterhow to get last string in phpstrrpos of last char in phpphp 7 4 get last word of stringphp position last characterphp get last n characters of stringphp find last spec charprint last 5 characters of string phpsubstr last character phpget string last character phpget the last number from a string phpphp return last number from stringphp get last 5 characters of stringphp last character in stringget last character in string phptake last 5 characters from string phphow to get last 10 chars in phpfind last letter in string phpphp get last element of stringget last character of string phpextract string from string php get the last letter of a string phplaravel string last valuehow to get last element of string phpphp last position of characterphp last stringtake last part of string phpfind last occurrence of character in string phpcheck last character phpcheck last character of string phpget 4 last text phpget last char in string in phpphp get first character of stringget last 2f from string 2b phpphp get last valueextract last character from string phpget last name from string in phphow to get last digit of a string in phpget last char of string phpget last four characters in string phphow to get the last character from a string phpin string get the last int phpphp get last x characters of stringphp 5c as last characterphp get all but last character of stringprint from middle of string phpphp last word in stringphp check if last character in string is xphp echo last monthlast character phpget only last 4 characters of string phpphp return last chars stringget last 4 digits of string phpsubstring to last character phpphp last letters of a word in stringget last string until charter phpget last index of character in string phpget last 3 characters phpphp substringhow to get last 2 char from given string using phpphp last charof stringlast 4 characters of string phpshow last 5 characters of string phpif last character in string phpphp get string before last occurrence of characterphp get last 2 chars in stringphp value from last 2 stringget the last caracter phpget last line phpget the index of the last character in a string phpphp substring lastsubstr phpphp last letter of stringphp get from string last characterget last word string phphow take the last character of a string in phpphp get last 3 letter 5cphp get string after last charphp all but last charactershow last characters from stirng phpget last elemnt string phpphp last character substrtake last 10 char of string phpphp get 3 last charsget last text in phpsubstring last 4 characters phpget lest char of a string phpphp function to get last 5 character of a stringphp check second last character of stringhow to get the last four characters of a string in phpget lengt of string phpstring last word in phpget last digit from string in pgpsubstring last character phpphp last x characters stringfind last position of character in string phpget last position of a char phpphp find last stringphp get last n chars from stringphp get last 3 characters of stringget last char of array phpphp last character of a stringlast in phpphp last occurrence of character in stringphp check last charactertake string from last 23 value in phpphp get last sign in stringstring last character phpcheck first two characters of string phphow to get the last character of a string in phpphp get last 11 char from stringgrab the last character of a php stringget last char in string phpget last char of words in string phpphp get last to chars in stringphp take last 5 character of stringphp string last 4last character of string phplast string character phpstring last position phpget last for letters phplast character string phpphp substring from 7 char from last last characterget last n characters of string phpget last 10 charecter from string phphow i can get last word of string in phpget the last index of string in phptake string from last value in phpphp get last second character of stringhow to get last same letter from a string phpphp check n last 3 characters of stringphp substr converts last characterstrpos php lastphp last index of stringstrpos with last occurrence in phpget last string from string phpphp get string from middle to lastget the last four characters of a string phplast word of string in phpfind last occurrence of character in a string phpget last char of a string phpphp string take from last letterphp get last 7 characters of stringphp last for charsphp copy part of stringphp get last four characters of stringphp last seen datetime with stringphp last letter from stringhow to get first and last character of string in phpsubstring phpphp substr get last 4 charactersphp get last 4 of stringget last letter of string phpphp get last name in stringphp check last value of stringcut symbol from the end of a string phphow to get last 4 characters from string in phpget last character of string in phpget last instance of string in string phpget the last char of string in phpphp function only display last caracterhow to substring a string in phpretrieve last char phpstring last index in phpindex of last a letter phpphp last 5 characters of stringphp start string after certain position and read next 2 indexphp last 4 letters of stngfind character into string from last in phpphp substring to get last characterhow to cut left string form character in phpget the last character of a string in phpphp substphp get last number from stringphp get the last character in a stringphp get the last two characters of a stringget the last string value phpget last string after phpphp get last 2 word of stringphp cut off end of stringhow to get the last character of a string phpphp substr get last charactercheck a string last chracahter in phpget last char polsition phpget last character from string phpphp get last 2fphp subtract last character from stringtake last 2 elements in string phpphp get last position of character in stringget last char string phphow to get the last four letters in a string in phpdisplay last 5 caracters phpget the before last char in string in phpphp get last 4 characters of string then 2b1how to get the last two digits in years phpphp array of strings last letterget last 5 items in a string phpget last word before character in string phpphp string method to find last three letters of a stringget last chracter in char array phpstring len select last characters phpphp get last characters of stringphp if last character isphp string get last occurrencephp return last n chars stringcompare sub string in php without substr functionphp string last 4 charactersget lat char phpphp get last word of stringget last characters of string phphow to get the last letter of every word in a string phpphp last char of a textget last charachter phpcatch last character of string in phpphp last chars of a stringget last word of string phpextract string from text phpphp strpos last charget last number from string phpget last charecter string phpget last 3 characters of string in phpread str from last phpget last character as integer phpprint pick last 2 characters string phpphp get last char from stringpph string 5c in last char has erro how to print the last string in an array in phpcut string to first 20 charactersphp get last 2 character of stringget last digit of string phpphp last charphp sub last 4 charcterslast character in phpphp get only last from stringphp first character of stringphp get last 4 charactersselect last two characters of string phpphp last char of stringget last word chararcters from string phpphp take last n characters stringget the last string phpget last letter php substring php last 4 characterslast char str phpphp get last 4 characters of string php last characters from stringlast 25 character of string phpget the last character of a string phplast index of in php stringphp get last 5 letters from stringstr last value in phpphp last charactergrab last 2 characters of a string phpphp last 3 characters of stringshow last character 2b php 7get last pos value in string in phphow to print string three last letters phphow to extract the last character of a string in phpphp substring with characterphp get last value from stringlast char of string in phpphph check if last character of the stringphp get last index of charphp string last charget last 4 string phpphp return last character of stringphp get last letter of stringhow to get the last character opf a php stringget last digit of a string phpphp get last character in stringlast four of string phpget last chracter of str phpget last 2 letters of string phpphp get last chararegex get last character phpget first and last character of string phpphp get last character from stringhow to get the last charcter of string in phphow to get last char of string in phpphp grab last line of stringfind first character in string explode phpphp get the characters before the last php get 3 last charactersphp last word stringcheck what the last character of a string is phpget last word in phpphp get last charphp get last 8 charsget char from end string phpget last char phpphp last element of stringphp get the last letter of stringhow to find the first and last character from a string in phpget last 3 character phphow to get last word from a string in phparray of string last alphabet is equal in phpphp get last bytes of stringphp get last part of string after characterget the last 2 character of a string phpcheck last character of sting phpget last number in string phpcheck last char of string phpget last characters from string phphow to get last digit of string in phpphp select first 3 characterslast word in string phpphp keep only last n char in stringphp string first and last characterphp get last 4php substring last 4 charactersphp get last three characters of stringphp get the last n character of a stringget first character of string phpphp string get last characterphp get las letter in stringlast index string phpget last string from phpfrom last position to character string phpget last character of a string in phpphp get last character positionget substring position laravelget last charater from string in phpsmall length from php stringphp get 3 last letterget last from string 2b phpget last occurrence of character in string phpget last caracter pos phpget the last 4 characters of a string in phpget x number of cars of string phplast char of string phpcheck last character of string in phpget last letter string phpstring slice in php aftercheck last letter of string phpget last letter of string in phplast char in string phpphp get last 10 characters of stringphp check last character of stringread last character of string phphow to get last 10 characters from string in phpphp get last charcaterget the last character of a string in php