Reputation: 51120
$word = "shshsh.shshsh";
print(rtrim($word, "sh."));
Output is an empty string when I would have expected it to output the entire string (since "sh." does not appear at the end in this case).
Upvotes: 3
Views: 125
Reputation: 14279
The "sh."
is a set of characters rather than a string to remove. It'll remove characters from the end of the $word
recursively as long as it's a character in [s, h, .]
, until it hits one that isn't in this list, essentially removing everything in your case.
Upvotes: 9