title: trim() function : How to avoid empty string return if the argument is unset/null variable?
body: <p>I have a problem when using the trim() function in php. </p>
  
  <pre><code>//Suppose the input variable is null.
  $input = NULL;
  echo (trim($input));
  </code></pre>
  
  <p>As shown above, the output of the codes is empty string if the input argument if NULL. Is there any way to avoid this? It seems the trim will return empty string by default if the input is unset or NULL value. </p>
  
  <p>This give me a hard time to use trim as following. </p>
  
  <pre><code>array_map('trim', $array);
  </code></pre>
  
  <p>I am wondering if there's any way I can accomplish the same result instead of looping through the array. I also noticed that the trim function has second parameter, by passing the second parameter, you can avoid some charlist. but it seems not work for me.</p>
  
  <p>Any ideas? Thanks.</p>