title: Php trim string at a particular character
body: <p>Is there a php string function to trim a string after a particular character. I had a look on the php.net site and did a google search but couldn't find anything. The only solution I could think of was explode and then grab the first part of the array but that's not the most elegant solution. </p>
  
  <p>For example </p>
  
  <pre><code>$string = "/gallery/image?a=b";
  $string = imaginary_function($string,'?');
  echo $string; //echoes "/gallery/image"
  </code></pre>
  
  <p>Does anyone know of a good cheat sheet for php string manipulation functions?
  Thanks</p>