title: PHP ltrim() and rtrim() functions
body: <p>I need two functions that take a string and the number of characters to trim from the right and left side and return it. E.g.:</p>
  <pre><code>$str = &quot;[test]&quot;;
  $str = ltrim($str, 1); // Becomes 'test]'
  $str = rtrim($str, 1); // Becomes 'test'
  </code></pre>
  <p>How can I do it?</p>