What is TRIM function in PHP?
trim()
removes all blank spaces or whitespace or other (specified) characters from both sides of a string.
$var = “ Best Interview Questions ”
echo $var;
Types:
- ltrim() – It removes whitespace/other specified characters from the left side of a string.
- rtrim() - It removes whitespace/other specified characters from the right side of a string.
BY Best Interview Question ON 05 May 2020
Example
$var = “Best Interview Questions”;
ltrim(“Best”, $var);
rtrim(“Questions”, $var);