1.

What is TRIM function in PHP?

Answer»

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.
Example

$var = “Best Interview Questions”;
ltrim(“Best”, $var);
rtrim(“Questions”, $var);



Discussion

No Comment Found