3v4l.org

run code in 300+ PHP versions simultaneously
<?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. echo '<br />'; $text2 = rtrim($text, 'a..z.'); echo $text2; // The whole last word is trimmed.

preferences:
40.2 ms | 402 KiB | 5 Q