PHP Trim Functions: trim, rtrim, nd ltrim
String variables are common in any programming language. You are likely going to use or manipulate a string at some point while programming. Sometimes, string variables are not at all perfect. Many of them may even have characters that need to be removed. Targeting specific locations of a string, PHP provides 3 string functions we can use to remove unwanted characters from a string variable: trim()
, ltrim()
and rtrim()
. Continue reading to see examples of each function…