get last word from string php

substr("testers", -1); // returns "s"

4.2
10
Awgiedawgie 440220 points

                                    phpCopy<?php  
$string = "This is a string";

$lastChar = $string[-1];
echo "The last char of the string is $lastChar.";
?>

4.2 (10 Votes)
0
4
3
Awgiedawgie 440220 points

                                    phpCopy<?php  
$string = 'This is a string';
$lastChar = substr($string, -1);
echo "The last char of the string is $lastChar.";
?>

4 (3 Votes)
0
4.11
9
Awgiedawgie 440220 points

                                    function getLastWord($string)
    {
        $string = explode(' ', $string);
        $last_word = array_pop($string);
        return $last_word;
    }

4.11 (9 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
php get the last letter of string get last 4 character in php php get the last two characters of a string phph check if last character of the string php get 3 last characters php get last 4 character of string get last character of string after specific php php get last string character php find last string get only last 4 characters of string php get last 4 string php regex get last character php how take the last character of a string in php take last 2 elements in string php take last part of string php php get last string how to get the last part of the string in php str - last value in php str last value in php php string take from last letter get last 3 characters php take last five characters in a string in php php string get last charcter get _last 10 charecter from string php php get last letters of string strrpos of last char in php last index of in php string get last pos value in string in php php get last index of char get last string until / php php get last n characters of string php get last position of character in string how to get the last character opf a php string get last digit of a string php get last 32 char php get last word before character in string php get last digit of string php php last index of string How do I grab last number in a string in PHP? php return last number from string how to find last 2 words in string php get last char of words in string php php last letters of a word in string how to find str position is last in php get last 10 characters string php if last character in string php how to get last element of string php get last string from string php php check last character of substring get last 3 letters of string php php substring last 4 characters last four of string php last word in string php php keep only last n char in string php get the last n character of a string string last value get in php print last 5 characters of string php get last character string php php echo lastt 10 characters of a string get last number from string php how to extract the last character of a string in php php string last char php take last two character of string get the last letter of a string php php last char in string how to get the last letter of every word in a string php how to get the last letter of each word in a string php php function only display last caracter get last string until charter php get last word of string php string last word in php get last letter string php get the last string php php last position of character php strpos last char how to get last digit of a string in php php get last part of string by character last string character php get last 3 character php php get first and last character of string GET LAST ELEMNT STRING PHP last char of a string php last index string php php get last occeance of word how to get last 10 chars in php from last position to character string php php find last instance of character in string php get only last from string get last caracter php php string first and last character php get last second character of string get last word in php get last charecter string php get the last value of a string in php how to check last element of string in php get last 7th character from last php last char in string php php get last word of string find last occurrence of character in string php last 25 character of string php php get string from middle to last php last 7 characters of string get last word chararcters from string php php last position of character in string last character string php php string last element php get last 6 characters in string get last word string php php get last 7 characters of string php return last character of string php \ as last character get the index of the last character in a string php php substr get last character RETRIEVE last char php php extract last word from string last char str php php get the last x char of a sentence php get second last character of string php get last letter from string get last character of string ph php string last 3 characters how to get last word from a string in php php get last n chars of string php extract last n words of string get last character of a string in php get last n character of string php get last word in a sentence php how to check last character of a string in php php get last 5 letters of string last 3 characters of string php get the last 4 characters of a string in php php function to get last 5 character of a string get the before last char in string in php get the last char of string in php php find last occurrence in string php subtract last character from string php get last sign in string get the last string value php take last 10 char of string php php check last value of string get last occurrence string php how to get last 2 char from given string using php how to get last 2 single char from given string using php php get last number from string php find the last number of a string pos php get last character position get last caracter pos php find last position of character in string php php get last four characters of string PHP last character of a string substr last characters php get last word from the string in php get last word from the strin gin php last word from string in php how to get last word from the string in php last word of string in php get last word from string of php get last word from string in php how i can get last word of string in php php last 4 letters of stng php get last bytes of string php get last 8 chars find last occurrence of character in a string php php string method to find last three letters of a string php get last 4 characters php all but last character get last 3 characters of string in php index of last a letter php php take last n characters string how to get the last four letters in a string in php last index of string php php get last two words in strin last character in php php get last x characters of string find last letter in string php get last 5 character from string php php grab last line of string php find last character in string how to get the last four characters of a string in php php string last 4 characters get last instance of string in string php get the last word from path in php php get last 5 characters of string php read the last characters get last string in php php detect last string caracter get only last character of string php get last 2 letters of string php php get last 10 characters of string last of string php php get last characters get the last 2 character of a string php get last 2 characters of string php php substr from last character get last / from string php get last char of array php get last chracter in char array php get last chracter of str php php last char of a text php last 5 characters of string php substr get last 4 characters select last 5 number in an string php get last 4 characters string php get last string before php if last element of string php php get last part of string last char of string in php display last 5 caracters php display last 4 characters in php strchr last character php get last / from string + php get last - from string + php get first last character php php get last index of string show last 5 characters of string php show last characters from stirng php php string last 4 substring php last 4 characters get the last four characters of a string php php string before last character get last position of a char php string last position php get last characters name php get last 10 characters from string php how to get the last character of a string php php last 4 characters of string php last word in string php last character substr php last x characters string php test last character of string php last char get last char in string php last characters string php php get last part of string after character get last character from url string php get last letters from string php check last letter of string php get last character of string in php check last character php php get last word php string get last character get first and last character of string php get the last index of string in php php take last character of string get the last string in php last position string php php last element of string php last charcter substring to last character php php last character read str from last php take string from last # value in php take string from last . value in php php get last 4 of string php check second last character of string php get all but last character of string substring last character php php get last 4 characters of string then +1 php last word string php get last 2 character of string get last name from string in php get string last position php php substring from 7 char from last last character php substring from last character last 4 characters of string php last 4 char of string php get last two characters of string php php last characters of string check string last character php get last word from string php php string check last character get last 4 characters of string php check the last character of a string php php 7.4 get last word of string php get last word in string php get last character of string string how to get last 10 characters from string in php php last occurrence of character in string php find last strpos how to get the last charcter of string in php get last string after / in php get last string after . php how to get first and last character of string in php how to get the last character from a string php php substring last character php get last 3 character of a string php last index of character in string php get last 3 characters of string show last character + php 7 how to print string three last letters php slice last char of string php php last 9 letter of string how to get the last two digits in years php php echo last month get lengt of string php how to get last char of string in php get lat char php php last for chars php string get last occurrence grab last 2 characters of a string php php get last 4 characters of string get last 3 characters of string php php value from last 2 string pph string \ in last char has erro pph string last \ php get last chara php get last two chart get last i digit from string in php substr last character php php print last character from string last cchar php php get first letter of string substring last 4 characters php php copy part of string cut symbol from the end of a string php compare sub string in php without substr function php get last 2 characters of string substr php variable & find first character in string explode php how to substring a string in php get substring position laravel cut a data from string php split first letter php read last character of string php string slice in php after substr in php get last 4 digits of string php print from middle of string php php subst get first character of string php sub string function index of in php get last string from php get last 3 digits of string php get last n characters of string php php check last character is a number get last char of string php select last two characters of string php php last string small length from php string explode string and get first letter of first index read last string in php string len select last characters php php get last value from string extract string from string php php get las letter in string substring php get last charater from string in php get last digit from string in pgp php check last character php substring with character php select first 3 characters php last character in string extract string from text php substr php last char check in string php php last charof string php start string after certain position and read next 2 index how to cut number string php SBSTR LAST DIGITS PHP php first character of string cut string to first 20 characters get char from end string php php substring php substr laravel string last value check first two characters of string php php get last part of a string how to cut left string form character in php how substring in string in php substring in php array of string last alphabet is equal in php check a string last chracahter in php php how to get last character of string how to get last same letter from a string php get last letter of string php check last character of string in php php last characters from string get last characters of string php find character into string from last in php php get last three characters of string php get last digit substr php get last 11 char from string get last index of character in string php get last char in string in php how to get string last character in php check what last character in string is php php get last element of string php array of strings last letter get last letter of string in php How to get the last character of a string in PHP? How to get the last character of a string in PHP? (5 pts) php get last character from string string last character php get 5 last character of string php how to get last character of string in php php last char of string get string last character php php get last char of string php get last characters of string get x number of cars of string php grab the last character of a php string last char php get last char php php get string last character check last character of string php get last characters from string php php check if last character in string is x get the last 3 chars in php php substr last character php check last character of string php check last characters of string last char php variable php substring to get last character get 4 last text php get last string php php get last char from string get last character as integer php get last char of a string php php get last letter of string php last certaint character of string find last character in string php get lest char of a string php php find last spec char get last character in string php php get from string last character last character php last char of string php php check last character in string last char string php get the last caracter of the srintg php get the last caracter php php get last char php cut off end of string how to get the last character of a string in php get the last fourth character from a string php php last letter of string php get the last character of a string last character of string php get the last character of a string php php substring last 3 characters get last letter php php get first character of string php get last character of string php last character of string php get last character get last char string php check last character of sting php php string last character get last character of string php php get the last character in a string php get last character in string php last chars of a string php last chars ofa string get last character of string laravel
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source