get last character of string php

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

showing results for - "get last character of string php"
Jessica
07 Mar 2018
1substr("testers", -1); // returns "s"
Mads
10 Jan 2021
1phpCopy<?php  
2$string = "This is a string";
3
4$lastChar = $string[-1];
5echo "The last char of the string is $lastChar.";
6?>
7
Isidora
27 Sep 2019
1function getLastWord($string)
2    {
3        $string = explode(' ', $string);
4        $last_word = array_pop($string);
5        return $last_word;
6    }
Sarah
11 Mar 2020
1phpCopy<?php  
2$string = 'This is a string';
3$lastChar = substr($string, -1);
4echo "The last char of the string is $lastChar.";
5?>
6
Aldrin
17 Mar 2016
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
Isaias
14 Feb 2019
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
queries leading to this page
php function to get last 5 character of a stringphp get last to chars in stringcheck last 3 character in string phpget the last value of a string in phpget last 2 letters of string phpget last digit of a string phpphp subtract last character from stringphp get 3 last charactersget last occurrence string phpget last char of string phphow to get last same letter from a string phpphp get last position of character in stringphp substring last characterhow to cut number string phptake string from last 23 value in phplast 3 characters of string phpget last index of character in string phphow do i grab last number in a string in php 3fhow to get the last letter of every word in a string phpphp substring to get last characterphp get substring from last 2fphp extract last n words of stringphp take last character of stringget last part of a string phpmatch last 4 char phpget x number of cars of string phplast char php variablehow to get last string in phpphp get last 11 char from stringget last word chararcters from string phplast char check in string phpget last word from the strin gin phpphp last charcterget last charachter phpphp get las letter in stringcheck string last character phpget string last position phpget lest char of a string phpcheck what last character in string is phpphp get last two chartphp substr last characterphp get last stringget last pos value in string in phpget last character from string phpcut a data from string phpphp get from string last characterphp string get last characterget last character of string phphow to get last 2 char from given string using phpphp get last character in stringfind last character in string phpcheck what the last character of a string is phpin string get the last int phpphp check last word in a stringsubstr in phpget lengt of string phpget the last 3 chars in phpphp get last name in stringget last word in phpphp get string behind the last characterget last character string phpphp substring with charactercatch last character of string in phpphp get last 4 of stringcheck last character of sting phpphp index of last character in stringget 5 last character of string phpphp last letters of a word in stringget last char of a string phpphp get last 2 word of stringlast index of in php stringdisplay last 5 caracters phpstrrpos of last char in phpphp get last 3 charaarray of string last alphabet is equal in phpphp string last charactertake last 2 elements in string phpsubstr last characters phpget the last 4 characters of a string in phpphp last stringget last word from the string in phpget last letter string phphow to get first and last character of string in phpphp get last charactersphp check n last 3 characters of stringhow to get the last four characters of a string in phpcheck last letter of string phpphp echo lastt 10 characters of a stringphp substring from 7 char from last last characterget last 10 characters of a string in phpphp last characters from stringget last string from phpget last character of a string in phpphp substring get last characterphp get last part of a stringfind character into string from last in phpprint pick last 2 characters string phptake string from last value in phpstrchr last character phpget last two characters of string phpphp return last number from stringphp get last sign in stringget last char in string in phpget the last string in phpphp last element of stringphp last character substrphp get first letter of stringphp get last word in stringget last char of array phpfind last occurrence of character in a string phpget last for letters phpphp substr from last characterphp substr get last charhow to get the last charcter of string in phpget last string until charter phpget last i digit from string in phpget last name from string in phplast word of string in phpget last word in a sentence phpphp keep only last n char in stringphp get last n chars of stringsubstring php last 4 charactersget first last character phpstring last index in phpphp get last four characters of stringphp string last 4 charactersget last character of string phget the last caracter of the srintg phphow to substring a string in phpcheck first two characters of string phpphp strpos last charphp 7 4 get last word of stringget last characters name phpcheck last char of string phpget last charater from string in phpphp get the last two characters of a stringif last character in string phpphp detect last string caracterget the last string value phphow to find str position is last in phplast 4 char of string phpphp last chars of a stringtake last part of string phpphp if last character ishow to get the last character opf a php stringphp check last characterhow to cut left string form character in phpphp get last 2 characters of stringget the last character of a string phpget last string in phpphp get the characters before the last php get last characters of stringget the last 2 character of a string phpphp get last char of stringstring len select last characters phpget last number from string phpphp get string before last occurrence of characterlast index string phpphp string last elementphp substr get last characterphp get string last characterfind last position of character in string phpphp get last 4php last 4 letters of stnghow to check last character of a string in phpcut string to first 20 charactersget last 3 characters phpphp get last 2 character of stringshow last characters from stirng phpphp get last index of stringphp substring from last charactersmall length from php stringphp last charof stringsubstr php variable 26get last 4 digits of string phpget the before last char in string in phpselect last 5 number in an string phpphp get the last character of a stringphp all but last characterget last string until 2f phplast in phpphp substr get last 4 charactersget last word string phphow to get the last character of a string in phpget string last character phpphp get last 5 characters of stringget last 2f from string 2b phpphp string check last characterget last caracter pos phpget last 4 characters string phpphp check last character of stringphp return last chars stringlaravel string last valueexplode string and get first letter of first indexphp cut off end of stringlast index of string phplast char in string phpget only last 4 characters of string phpget last word of string phpget first character of string phpget last 10 characters string phppph string 5c in last char has erro php get last 4 characters of string then 2b1how to check last element of string in phpphp get last letter from stringhow to get string last character in phpget last string from string phpphp return last character of stringphp extract last word from stringget last character in string phpphp last position of characterfind position of last element in string phpcheck last character of string in phplast four of string phphow to find the first and last character from a string in phpphp last char in stringphp string get last occurrencedisplay last 4 characters in phpget last char in string phpfind last occurrence of character in string phplast word in string phplast character phpphp last letter of stringget the last four characters of a string phpsub string function index of in phpphp take last n characters stringphp last charactergrab last 2 characters of a string phplast 25 character of string phpphp get last numbers from stringphp get last 4 characters of string php get last 3 character of a stringsubstring last 4 characters phpphp check last character of substringphp last chars ofa stringphp start string after certain position and read next 2 indexget last 4 characters of string phpprint from middle of string phphow to get last 2 single char from given string using phpphp get last 5 letters of stringphp grab last line of stringget last occurrence of character in string phpphp get last char from stringget last chracter of str phpphp last index of character in stringphp array of strings last letterphp get last charcaterget last 2f from string phpphp get last 2 characters stringlast 4 characters of string phpget last character as integer phpget last letter php php get last 7 characters of stringhow i can get last word of string in phpphp find last stringhow to get last few characters from a string in phpget last string before phpget only last character of string phpphp return last n chars stringhow to get the last character from a string phptake last 10 char of string phpphp print last character from stringphp get last word of stringphp last certaint character of stringhow to get last 10 chars in phpphp get last character of string stringslice last char of string phpphp get first and last character of stringget last number in string phpget last text in phpphph check if last character of the stringphp last word stringshow last 5 characters of string phpget last 7th character from last phpphp last part of stringphp last charget substring position laravelget last 3 letters of string phpphp check if last character in string is xfind last letter in string phpget last 3 digits of string phpphp string get last charcterget last string phpphp get first and last name from stringprint last 5 characters of string phpget last char string phphow to get the last letter of each word in a string phpphp get all but last character of stringhow to get the last four letters in a string in phpphp get last 3 characters of stringphp get last 2fphp get last charaphp get the last character in a stringphp get 3 last charsphp get last 5 letters from stringget the last index of string in phpsbstr last digits phpcheck a string last chracahter in phpget last charecter string phphow to get last word of string in phpphp string before last characterphp last char of a textphp get last character from stringgrab the last character of a php stringphp get last 3 letter 5cphp get last 2 chars in stringphp function only display last caracterphp get last part of string by characterget last line phpget last letter of string in phplast char str phpphp substringread str from last phpphp get last two words in strinlast cchar phpphp find last occurrence in stringphp substring lastphp get last x characters of stringget last elemnt string phpphp get last 4 charactersget last letters from string phpsubstr last character phpphp get second last character of stringphp find last strposget last 3 character phpstring slice in php afterget last characters of string phpget first and last character of string phpphp last index of stringget the last char of string in phphow to get the last character of a string in php 3fphp get last 8 charsphp get last part of string after characterget word after last string phphow to get last char of string in phpget last digit of string phpget last x characters from string phpphp last letter from stringphp find last function before funtionlast character string phpphp last 9 letter of stringphp check second last character of stringget last 4 string phpget the last fourth character from a string phplast char of a string phpphp get last 6 characters in stringget last chracter in char array phpphp get last character of stringfrom last position to character string phpphp get the last n character of a stringget last four characters in string phpphp check last character is a numberget last character of string in phpphp first character of stringcheck the last character of a string phpphp get last string characterphp get last number from stringget last 32 char phpphp last character of stringphp get string after last charphp last position of character in stringphp last character of a stringphp check last characters of stringphp take last 5 character of stringphp last for charslast char string phpphp substrget last letter of string phpphp last char of stringphp select first 3 charactersphp position last characterget last position of a char phpsubstr phpphp find last spec charget last string after phpget last character of string after specific phpstring last character phpphp last seen datetime with stringget last n character of string phphow to get last word from the string in phpphp last occurrence of character in stringphp find last index of stringphp string method to find last three letters of a stringphp get last element of stringget last n characters of string phpstr last value in phpphp string last 3 characterslast char phpphp last x characters stringread last character of string phpphp get last 10 characters of stringphp get string from middle to laststring last word in phpget last char phpphp check last character in stringphp get last letters of stringphp get last 4 character of stringfind first character in string explode phpget last digit from string in pgpphp string last 4string last position phpin text get last string phpphp how to get last character of stringphp check the last character of a stringsubstring in phplast characters string phpget last word from string phpphp get 2 last word of stringget char from end string phpsubstring to last character phpget last 2 characters of string phpget the last word from path in phpget last characters from string phpphp get last characterget the index of the last character in a string phphow substring in string in phpphp get only last from stringphp check last value of stringphp last part of a stringhow to get last 4 characters from string in phpphp get last part of stringget last from string 2b phpphp copy part of stringphp get last index of charhow to print the last string in an array in phpget last 10 charecter from string phplast char of string phpget everything before the last character phpphp value from last 2 stringstring last value get in phplast position string phpphp find last character in stringget last char of words in string phpphp find last instance of character in stringget last character from url string phptake last five characters in a string in phpphp find the last number of a string posphp get last n characters of stringget last 4 character in phpphp string last n charactersread last string in phpphp take last 4 charactersphp substphp 5c as last characterget last 3 characters of string in phpget the last string phpget last word from string of phpfind the last lette in a string phpget last character of string laraveltake last 5 characters from string phpget last 5 character from string phpstrpos with last occurrence in phphow to get last digit of string in phpregex get last character phpget last string after 2f in phpget the last letter of a string phphow to get the last part of the string in phpcompare sub string in php without substr functionphp substring last 3 charactersindex of last a letter phpextract string from text phpphp last characters of stringlast of string phpget last instance of string in string phpcheck last character of string phpphp get last valuehow to get last character of string in phpphp take last two character of stringget last caracter phpphp get last integer from stringget the last character of a string in phphow to get last word from a string in phpphp read the last charactersphp string last charphp echo last monthcut symbol from the end of a string phphow to extract the last character of a string in phpphp get last digit substrphp last word in stringhow take the last character of a string in phplast char of string in phpphp get last character positionget the last number from string phpsubstring phpphp last 3 characters of stringphp get first character of stringget last three characters of string phpphp get the last letter of stringphp get last wordget last word before character in string phpretrieve last char phpget the last caracter phpget last 10 characters from string phpsubstring last character phplast character in phpphp get last second character of stringphp test last character of stringget last word from string in phpstrpos php lastshow last character 2b php 7get lat char phpcheck last character phpphp get last bytes of stringphp get last value from stringget 4 last text phpphp get the last x char of a sentencestr last value in phplast word from string in phpphp last character in stringlast string character phpphp string take from last letterphp exclde last 4 characters from stringhow to get last digit of a string in phpphp get last occeance of wordselect last two characters of string phpsplit first letter phpphp string first and last charactersubstr php show only last 4 characterphp get last letter of stringget the last number from a string phpget last 3 characters of string phpphp get last 2 wordhow to get last 10 characters from string in phppph string last 5chow to find last 2 words in string phpget last 5 items in a string phphow to print string three last letters phpphp get last three characters of stringphp last 4 characters of stringlast character of string phpphp last 5 characters of stringhow to get last element of string phpphp substring last 4 charactersphp last string charextract string from string php php strpos last occurrenceget last char polsition phpphp get last charif last element of string phphow to get the last character of a string in php 3f 285 pts 29php last 7 characters of stringhow to get the last character of a string phphow to get the last two digits in years phpget last character of string php