title: PHP equivalent of JavaScript's substring()
body: <p>JavaScript has two handy substring functions: <code>substring(from,to)</code> and <code>substr(start,length)</code>.</p>
  <p>This means I can decide &quot;when I get my substring starting from position X, do I want to specify what string position to end on or how many characters long the substring is?&quot;</p>
  <p>(One nice usage of the <code>from, to</code> version is to use <code>search()</code> to determine both positions.)</p>
  <p>PHP's <code>substr()</code> lets you specify the length of the substring. Is there a built-in string function to let you specify the character position to end on?</p>