NYCPHP Meetup

NYPHP.org

[nycphp-talk] delete one element from array

Darryle Steplight dsteplight at gmail.com
Wed Jun 3 21:49:04 EDT 2009


There's a few ways to skin this cat but Eddie is right. Based one this
email's title I think using unset() should suffice.

On Wed, Jun 3, 2009 at 9:43 PM, Eddie Drapkin <oorza2k5 at gmail.com> wrote:
> unset() will work, but won't reset the numerical index, which is the only
> thing array_slice is being used for; if he needs the index in the same
> order, unset() is a better option as it's faster, but if he needs a
> re-index, we'd have to benchmark :]
>
> On Wed, Jun 3, 2009 at 9:40 PM, John Campbell <jcampbell1 at gmail.com> wrote:
>>
>> I think you want array_splice, rather than array_slice
>>
>> array_splice($arr,6,1);
>>
>> Regards,
>> -John Campbell
>> _______________________________________________
>> New York PHP User Group Community Talk Mailing List
>> http://lists.nyphp.org/mailman/listinfo/talk
>>
>> http://www.nyphp.org/show_participation.php
>
>
> _______________________________________________
> New York PHP User Group Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> http://www.nyphp.org/show_participation.php
>



-- 
A: It reverses the normal flow of conversation.
Q: What's wrong with top-posting?
A: Top-posting.
Q: What's the biggest scourge on plain text email discussions?



More information about the talk mailing list