NYCPHP Meetup

[nycphp-talk] Accessing First Element of Array

Michael B Allen ioplex at gmail.com
Sun Aug 26 21:08:47 EDT 2007


On 8/26/07, Jon Baer <jonbaer at jonbaer.com> wrote:
> Is it anything that $array[0] would not be able to get access to?

Hi Jon,

Nope. The 0 element is not necessarily first. Consider the following example:

$array = array();
$array['first'] = 'foo';
$array[] = 'bar';

$ ./t.php
Array
(
    [first] => foo
    [0] => bar
)

In this case the element 'foo' is first.

Mike



More information about the talk mailing list