PHP Interview Questions
Which functions are used to remove whitespaces from the string?
There are three functions in PHP to remove the whitespaces from the string.
 
trim() : It removes whitespaces from the left and right side of the string.
ltrim() : It removes whitespaces from the left side of the string.
rtrim() : It removes whitespaces from the right side of the string.

Exmple :
$str = " Tutorials for your help";
$val1 = trim($str);
$val2 = ltrim($str);
$val3 = rtrim($str);‚Äč