Answers for "get last word in string before space php"

PHP
1

get last word from string php

function getLastWord($string)
    {
        $string = explode(' ', $string);
        $last_word = array_pop($string);
        return $last_word;
    }
Posted by: Guest on February-26-2021
0

extract text before last space php

$string = "hello world again";
 echo substr($string, 0, strripos($string, ' '));//hello world
Posted by: Guest on September-24-2021

Code answers related to "get last word in string before space php"

Browse Popular Code Answers by Language