title: string between function to fetch multiple strings having same start and end strings in PHP. and store them in array variable
body: <p>i am trying to parse contents from someone others website into my PHP project using some string between function. but there are multiple strings having same 'start' and 'end' strings. so i wants all of them to be stored in an array variable.</p>
  
  <p>through my string between function it returns only first string.</p>
  
  <p>exp:</p>
  
  <pre><code>$string='afghjuyakkg';
  $start_string='a';
  $end_string='g';
  </code></pre>
  
  <p>my get_string_between function is:</p>
  
  <pre><code>function get_string_between($string, $start, $end)
      {
          $string = ' '.$string;
          $ini = strpos($string,$start);
              if ($ini == 0) return '';
              $ini += strlen($start);   
              $len = strpos($string,$end,$ini) - $ini;
              return substr($string,$ini,$len);
      }
      $result=get_string_between($string, $start_string, $end_string);
  </code></pre>
  
  <p>it should return  'f,kk'</p>
  
  <p>but it returns only 'f'.
  I am new to PHP so please help me.</p>