I've got some entries that I'd like to check last char if is "s" and replace them if that is the case (UTF-8 though).
So for example I've got various strings:
$first = "Pass";
$second = "Jacks Inventory";
$third = "First Second Third etc";
I want it to look each word if the last char is "s" for example to replace it with "n". I am not sure which is the best way to do that.
I know I can grab the last char of the string with the following code (not sure if that is the best way still):
mb_substr($string,-1,1,'UTF-8');
But that won't do it for each word the string has.