NYCPHP Meetup

NYPHP.org

[nycphp-talk] delete one element from array

Eddie Drapkin oorza2k5 at gmail.com
Wed Jun 3 21:43:35 EDT 2009


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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20090603/4ceb7f64/attachment.html>


More information about the talk mailing list