The trim () function in php is defined as follows:

trim (string, charlist)

The parameters are described as follows:

string is required. Specifies the string to be checked.


Optional. Specifies which characters are removed from the string.If omitted,Remove all of the following characters:

"\ 0"-null

"\ t"-tab

"\ n"-newline

"\ x0b"-vertical tab

"\ r"-carriage return


The sample code is as follows:

 echo trim ($str);
 echo "<br />";
 echo trim ($str, "\ r \ r (::)");

The results are as follows:

  • Previous Java implements HTTP Post, Get, proxy access requests
  • Next My main new features of PHP 70