0
$aa = 'come on\n';
var_dump(trim($aa,'\n'));

a result of "come on" is expected, but the result of php performed is "come o". so I have no idea what happended.

Tim
  • 322
  • 1
  • 3
  • 14
  • 1
    trim does a strip all instances of the characters in your list (`\\` and `n`) so when it trims the `\\` you get `come onn` and when it trims the `n` you get `come o` – Mark Baker Apr 05 '16 at 08:58
  • 1
    Is it maybe that you were trying to trim new lines? In which case your problem are the single quotes. PHP does not replace escaped characters (including ```\n``` ) with a new line when using single quotes (providing a slight performance improvement) – César Apr 05 '16 at 09:01

0 Answers0