title: How to extract substring by start-index and end-index?
body: <pre><code>$str = 'HelloWorld';
  $sub = substr($str, 3, 5);
  echo $sub; // prints "loWor"
  </code></pre>
  
  <p>I know that substr() takes the first parameter, 2nd parameter is start index, while 3rd parameter is substring length to extract. What I need is to extract substring by <strong>startIndex</strong> and <strong>endIndex</strong>. What I need is something like this:</p>
  
  <pre><code>$str = 'HelloWorld';
  $sub = my_substr_function($str, 3, 5);
  echo $sub; // prints "lo"
  </code></pre>
  
  <p>Is there a function that does that in php? Or can you help me with a workaround solution, please?</p>