title: Get first 9 elements from Google RSS feed xml in PHP
body: <p>I'm currently working with Google RSS feeds. I received this XML response. </p>
  
  <pre><code>&lt;rss version="2.0"&gt;
  &lt;channel&gt;
  &lt;generator&gt;NFE/1.0&lt;/generator&gt;
  &lt;title&gt;blockchain - Google News&lt;/title&gt;
  &lt;link&gt;...&lt;/link&gt;
  &lt;language&gt;en&lt;/language&gt;
  &lt;webMaster&gt;news-feedback@google.com&lt;/webMaster&gt;
  &lt;copyright&gt;&amp;copy;2017 Google&lt;/copyright&gt;
  &lt;pubDate&gt;Fri, 17 Nov 2017 09:41:26 GMT&lt;/pubDate&gt;
  &lt;lastBuildDate&gt;Fri, 17 Nov 2017 09:41:26 GMT&lt;/lastBuildDate&gt;
  &lt;image&gt;...&lt;/image&gt;
  &lt;description&gt;Google News&lt;/description&gt;
  &lt;item&gt;...&lt;/item&gt;
  &lt;item&gt;...&lt;/item&gt;
  &lt;item&gt;...&lt;/item&gt;
  &lt;item&gt;...&lt;/item&gt;
  &lt;item&gt;...&lt;/item&gt;
  &lt;item&gt;...&lt;/item&gt;
  &lt;item&gt;...&lt;/item&gt;
  &lt;item&gt;...&lt;/item&gt;
  &lt;item&gt;...&lt;/item&gt;
  &lt;item&gt;...&lt;/item&gt;
  &lt;/channel&gt;
  &lt;/rss&gt;
  </code></pre>
  
  <p>I'm using this <code>foreach()</code> to loop through all items:</p>
  
  <pre><code>$rss = simplexml_load_file('https://news.google.com/news/rss/headlines/section/q/blockchain/blockchain?ned=us&amp;hl=en&amp;gl=US');
  
  foreach ($rss-&gt;channel-&gt;item as $item) {
      echo $item-&gt;title."&lt;br/&gt;";
      echo $item-&gt;link."&lt;br/&gt;";
      echo $item-&gt;pubDate."&lt;br/&gt;";
  }
  </code></pre>
  
  <p>But this foreach returns me all items.</p>
  
  <p>How can I get only first 9 items from this XML?</p>