<?php
$text = "This string contains some unwanted characters on the end.";
$text1 = rtrim($text, 'a..z');
$text1 = rtrim($text1, '.');
echo $text1; // only the '.' is trimmed.
$text2 = rtrim($text, 'a..z.');
echo $text2; // The whole last word is trimmed.
This string contains some unwanted characters on the endThis string contains some unwanted characters on the
Output for 5.1.0
<br />
<b>Fatal error</b>: fatal flex scanner internal error--end of buffer missed in <b>/in/RUUuQ</b> on line <b>8</b><br />
Process exited with code 255.