<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <title>Kirk Bushell - Retrieve the First Element of an Array Comments</title>
  <id>tag:kirkbushell.com,2010:/articles/retrieve-the-first-element-of-an-array/comments</id>
  <generator uri="http://mephistoblog.com" version="0.8.0">Mephisto Drax</generator>
  <link href="http://kirkbushell.com/articles/retrieve-the-first-element-of-an-array/comments.xml" rel="self" type="application/atom+xml"/>
  <link href="/articles/retrieve-the-first-element-of-an-array" rel="alternate" type="text/html"/>
  <updated>2009-05-17T00:04:37Z</updated>
  <entry xml:base="http://kirkbushell.com/">
    <author>
      <name>Kirk Bushell</name>
    </author>
    <id>tag:kirkbushell.com,2009-05-10:1781:1798</id>
    <published>2009-05-17T00:04:37Z</published>
    <updated>2009-05-17T00:04:37Z</updated>
    <category term="Blog"/>
    <link href="http://kirkbushell.com/articles/retrieve-the-first-element-of-an-array" rel="alternate" type="text/html"/>
    <title>Comment on 'Retrieve the First Element of an Array' by Kirk Bushell</title>
<content type="html">There you have it - cheers Joe =) Have updated the function to use that.</content>  </entry>
  <entry xml:base="http://kirkbushell.com/">
    <author>
      <name>Joe Beeson</name>
    </author>
    <id>tag:kirkbushell.com,2009-05-10:1781:1796</id>
    <published>2009-05-15T16:40:10Z</published>
    <updated>2009-05-15T16:40:10Z</updated>
    <category term="Blog"/>
    <link href="http://kirkbushell.com/articles/retrieve-the-first-element-of-an-array" rel="alternate" type="text/html"/>
    <title>Comment on 'Retrieve the First Element of an Array' by Joe Beeson</title>
<content type="html">array_slice($array, 0, 1)</content>  </entry>
  <entry xml:base="http://kirkbushell.com/">
    <author>
      <name>Kirk Bushell</name>
    </author>
    <id>tag:kirkbushell.com,2009-05-10:1781:1792</id>
    <published>2009-05-13T03:51:54Z</published>
    <updated>2009-05-13T03:51:54Z</updated>
    <category term="Blog"/>
    <link href="http://kirkbushell.com/articles/retrieve-the-first-element-of-an-array" rel="alternate" type="text/html"/>
    <title>Comment on 'Retrieve the First Element of an Array' by Kirk Bushell</title>
<content type="html">Craig - who knows! Perhaps person x is super tight on performance, and doesn't want to store an unnecessary variable? Reset would be my first bet whenever retrieving the first element, but I think it could lead to some unexpected results at times, hence writing this function.</content>  </entry>
  <entry xml:base="http://kirkbushell.com/">
    <author>
      <name>Craig</name>
    </author>
    <id>tag:kirkbushell.com,2009-05-10:1781:1791</id>
    <published>2009-05-13T00:44:23Z</published>
    <updated>2009-05-13T00:44:23Z</updated>
    <category term="Blog"/>
    <link href="http://kirkbushell.com/articles/retrieve-the-first-element-of-an-array" rel="alternate" type="text/html"/>
    <title>Comment on 'Retrieve the First Element of an Array' by Craig</title>
<content type="html">Well, if you were using a foreach it wouldnt matter because foreach uses a copy of the original, so if you were resetting the original it wouldnt effect the loop..

ps.. why would you want the first element in a loop, you would get it before the loop surely!</content>  </entry>
  <entry xml:base="http://kirkbushell.com/">
    <author>
      <name>Kirk Bushell</name>
    </author>
    <id>tag:kirkbushell.com,2009-05-10:1781:1786</id>
    <published>2009-05-12T06:43:46Z</published>
    <updated>2009-05-12T06:43:46Z</updated>
    <category term="Blog"/>
    <link href="http://kirkbushell.com/articles/retrieve-the-first-element-of-an-array" rel="alternate" type="text/html"/>
    <title>Comment on 'Retrieve the First Element of an Array' by Kirk Bushell</title>
<content type="html">Absolutely Craig, but what if you're within a loop of that array?</content>  </entry>
  <entry xml:base="http://kirkbushell.com/">
    <author>
      <name>Craig Morris</name>
    </author>
    <id>tag:kirkbushell.com,2009-05-10:1781:1782</id>
    <published>2009-05-11T03:20:20Z</published>
    <updated>2009-05-11T03:20:20Z</updated>
    <category term="Blog"/>
    <link href="http://kirkbushell.com/articles/retrieve-the-first-element-of-an-array" rel="alternate" type="text/html"/>
    <title>Comment on 'Retrieve the First Element of an Array' by Craig Morris</title>
<content type="html">reset($array); 

???</content>  </entry>
</feed>
