What is trim in PHP?
trim() function in PHP removes whitespace from both sides of a string. trim() function also removes other predefined characters from the string. Genrally we use trim function where we require zero error like in the case of user id or email or password in which a whitespace can change the whole thing.There are two other function with some where Works like Trim function there are
$str = “whatwhyhow”;
Output will be hathyow
What is LTRIM?
ltrim() works like trim function the difference is ltrim removes only whitespace from left side of string. there is no other difference between TRIM and LTRIM function .
What is RTRIM?
rtrim() works like trim function the difference is rtrim removes only whitespace from right side of string. there is no other difference between TRIM and RTRIM function .