$string = "Hello World Again". echo strrchr($string , ' '); // Gets ' Again'
Now I want to get "Hello World" from the $string [The substring before the last occurrence of a space ' ' ]. How do I get it??
$string
$string = "Hello World Again"; echo substr($string, 0, strrpos( $string, ' ') ); //Hello World
If the character isn't found, nothing is echoed
1.4m articles
1.4m replys
5 comments
57.0k users