In this article, we show how to lớn remove whitespace either from the left side of a string or the right side of a string using the PHP trim() function.
Bạn đang xem: Php trim() function: remove characters from stringThe trim() function erases white space from the left & right side of a string. This will be demonstrated below. So, if we have the string "GPS ", after passing it through the trim() function, the stringwould then change to "GPS".The trim() function erases white space from the left và right sides of a string. So if the string is " GPS", and we apply the trim() function, it would change to "GPS". Similarly, the string, " GPS ", would change khổng lồ "GPS".