How to obtain the last word of a string

后端 未结 8 2220
囚心锁ツ
囚心锁ツ 2020-12-03 19:53

we have that string:

\"I like to eat apple\"

How can I obtain the result \"apple\" ?

8条回答
  •  失恋的感觉
    2020-12-03 20:40

    a bit late to the party but this works too

    $last = strrchr($string,' ');
    

    as per http://www.w3schools.com/php/func_string_strrchr.asp

提交回复
热议问题