Hi all,

On Mon, Oct 31, 2016 at 4:08 AM, Fleshgrinder <p...@fleshgrinder.com> wrote:
> On 10/30/2016 4:08 PM, Rasmus Schultz wrote:
>> But either way, I think I'm changing my mind about this one.
>>
>> And if the these functions support only arrays, then also the names
>> should probably be array_first() and array_last() for consistency with
>> other array-only functions.
>>
>> Perhaps better to make people be explicit, rather than trying to hide
>> side-effects to achieve shorter syntax...
>>
>
> +1

+1

There should be delete option. It's more useful if there is this option.

mixed array_first(array $arr [,bool $get_key = FALSE [, bool
$remove_entry=FALSE]]);
mixed array_last(array $arr [,bool $get_key = FALSE [, bool
$remove_entry=FALSE]]);

Problem with this is error condition. When array is empty, what should
be returned from these with default option?  Returning NULL for empty
array would be enough. IMO.

On Mon, Oct 31, 2016 at 1:52 AM, Levi Morrison <le...@php.net> wrote:
> To clarify, do you use the return value of these functions or rely on
> the IAP moving to also get the key?

Depends on code, but I usually use them just to get value of head/tail
element. It could be array_slice/splice, so I don't have much problem
with removing internal array position pointer. However, I still need
current() or each() to get value from returned array. This applies to
array_first/last($arr, TRUE);

Regards,

--
Yasuo Ohgaki
yohg...@ohgaki.net

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to