PHP rtrim() function – Trim end of string (right trim) in PHP

In this video I will show you the PHP rtrim() function


By default (without a $charlist), rtrim() removes the following whitespace from the right side of a string:

‘ ‘ spaces
‘t’ tabs
‘n’ new lines
‘r’ carriage returns
‘’ NUL-bytes


Use the form:
for the default behaviour


Or use the form:
rtrim($your_string, $your_charlist)
to specify which characters you want to remove


You can specify each character individually …


… or you can use ranges within your character set using the a..z double dot format.

This sample is functionally identical to the previous one.


Check out the code on this page for example usage!


If you found this video helpful, please subscribe to HelpVideoGuru on YouTube


Xem thêm bài viết khác:

Leave a Reply

Your email address will not be published. Required fields are marked *