Hmmm I dunno, if that was more towards "what was the way to access the first element of a hash?" I would say ok, but Im still convinced most would see an "array" as an object numerically indexed.

But current() it is :-)  Time to rewrite all those PHP books ...

On a side note to why the example does not work as expected - (I think it came up on the list way back):

The docs do not specify this, but adding to the array using the brackets syntax:
     $my_array[] = $new_value;
will not advance the internal pointer of the array. therefore, you cannot use current() to get the last value added or key() to get the key of the most recently added element.

- Jon

On Aug 26, 2007, at 9:08 PM, Michael B Allen wrote:

On 8/26/07, Jon Baer <[EMAIL PROTECTED]> 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
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to