title: How to get a substring between two strings in PHP?
body: <p>I need a function that returns the substring between two words (or two characters).
  I'm wondering whether there is a php function that achieves that. I do not want to think about regex (well, I could do one but really don't think it's the best way to go). Thinking of <code>strpos</code> and <code>substr</code> functions.
  Here's an example:<br/></p>
  <pre><code>$string = &quot;foo I wanna a cake foo&quot;;
  </code></pre>
  <p>We call the function: <code>$substring = getInnerSubstring($string,&quot;foo&quot;);</code> <br/>
  It returns: &quot; I wanna a cake &quot;.<br/></p>
  <hr />
  <p><strong>Update:</strong>
  Well, till now, I can just get a substring beteen two words in just one string, do you permit to let me go a bit farther and ask if I can extend the use of <code>getInnerSubstring($str,$delim)</code> to get any strings that are between delim value, example:</p>
  <pre><code>$string =&quot; foo I like php foo, but foo I also like asp foo, foo I feel hero  foo&quot;;
  </code></pre>
  <p>I get an array like <code>{&quot;I like php&quot;, &quot;I also like asp&quot;, &quot;I feel hero&quot;}</code>.</p>