The shortest path to your goal is:
1 $string = 'this is my - string - and more';
2 $res = explode(' - ', $string); //$res is now an array of three elements...
3 $last = end($str); //$last should now be: 'and more'
EXPLANATION
At the second line above, the explode() function had splitted your string using the ( ' - ' ) delimiter and stored the result into the $res variable, which is now an array contains three elements as follow:
$res => [
'this is my',
'string',
'and more'
]
At the third line, the end() function returned the last element of $res.
In general, your goal is made of two simple steps. And PHP does already provide several built-in functions to achieve each step like:
'explode( )' //splits a string using a delimiter...
'preg_split( )'; //splits a string usin a regex pattern.
end( ) //returns the 'last' element of an array or 'false' if empty array.
array_pop( ) //deletes the last element off an array AND returns it.
You could refer to the manual for each one of the above functions by clicking on its name. The manual shows detailed explanation and usage examples in various scenarios.
=========================================================
SOLUTION 2:
Another path might be:
1 $string = 'this is my - string - and more';
2 $pos = strrpos($string, ' - ');
3 $str = substr($string, $pos + 3);
EXPLANATION:
At the second line above, the strrpos() function searches for the last occurrence of ( ' - ' ) inside our $string -this is what you want- and returns its position in relation to it; i.e.: start counting from the beginning of $string untill the last occurrence of ( ' - ' ). In our string above, if we count how many characters there are before the appearance of the last instance of ( ' - ' ), we will find them (18) characters, and this means the first character of ( ' - ' ) is located exactly at 19. Please, remember here that this is a zero-indexed counting; i.e.: we start counting from 0 not from 1, which means the the first character 't' is indexed at 0 not at 1, and the second 'h' is indexed at 1 not at 2... etc. etc.
At the third line, now that we know where to start splitting, we use the substr( ) function which does just that: it splits (extracts) a given string at a certain position. However, if we are to split the $string at 19 the result would be " - and more", because 19 is where the ( ' - ' ) starts. Hence we should take into account the length of ( ' - ' ) and add it to the $pos. In our case, the ( ' - ' ) is three-character length; and this is why I added (+3) to $pos in the code above. And by the way, if your $split_point is varying from task to task, you might want to store its length in another variable, let it be $len, for example. And our code would be:
1 $split_point = ' - '
2 $string = 'this is my - string - and more';
3 $pos = strrpos($string, $split_point);
4 $len = strlen($split_point);
5 $str = substr($string, $pos + $len);
Or.. for shorter code:
1 $split_point = ' - '
2 $string = 'this is my - string - and more';
3 $pos = strrpos($string, $split_point) + strlen($split_point);
4 $str = substr($string, $pos);
even shorter..
1 $split_point = ' - '
2 $string = 'this is my - string - and more';
3 $str = substr($string, strrpos($string, $split_point) + strlen($split_point));
In all these cases the $str variable should now be 'and more'; and you might want to trim the $srt using the trim() function as a final step.
strrpo( )
substr( )
strlen( )
trim( )
For your scenario, though, I find the end() function easier, more straight forward, and memorable. There's no need to re-invent the wheel.