title: Substring between two indices
body: <p>The objective of my program: To split a big string, into an array of strings, each of which contains the segment of text between the substring "zone", and the next occurence of this same substring.</p>
  
  <p>What I tried:</p>
  
  <pre><code>#Get file into a string
  $filecont=file_get_contents($filename);
  #Count all occurences of the substring, and get the positions of the substring into the array $arr
  $arr=strallpos($filecont,"zone",0);
  #The function strallpos does its job. The array $arr is now:
  #Array ( [0] =&gt; 70 [1] =&gt; 148 [2] =&gt; 197 [3] =&gt; 316 [4] =&gt; 500 [5] =&gt; 637 [6] =&gt; 709 [7] =&gt; 748 [8] =&gt; 867 [9] =&gt; 878 [10] =&gt; 940 [11] =&gt; 990 [12] =&gt; 1154 [13] =&gt; 1321 [14] =&gt; 1440 [15] =&gt; 1561 [16] =&gt; 1684 [17] =&gt; 1695 [18] =&gt; 1759 [19] =&gt; 1811 [20] =&gt; 1926 [21] =&gt; 2045 [22] =&gt; 2168 [23] =&gt; 2285 )
  #Find and return the substring
  for ($i=0;($i+1)&lt;=count($arr);$i++)
  {       
      #Line 53 follows
      print (substr ($filecont,$arr($i),($arr($i+1)-$arr($i))));      
  }
  </code></pre>
  
  <p>The error I get is: <code>Fatal error: Function name must be a string in C:\wamp\www\dns.php on line 53</code></p>
  
  <p>What am I doing wrong? I'd like some pointers on the error code.</p>