php string function to get substring before the last occurrence of a character
php
Solution
This is kind of a cheap way to do it, but you could split, pop, and then join to get it done:
$string = 'Hello World Again';
$string = explode(' ', $string);
array_pop($string);
$string = implode(' ', $string);
Problem
``` $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??