FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » arrays with holes
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: arrays with holes [message #176742 is a reply to message #176741] Fri, 20 January 2012 20:44 Go to previous messageGo to previous message
cate is currently offline  cate
Messages: 12
Registered: January 2012
Karma:
Junior Member
On Jan 20, 2:42 pm, cate <catebekens...@yahoo.com> wrote:
> still! a php newbie.  This is kind of a touch base question.  I think
> I have it...
>
> I have an indexed array in which I progressively remove elements with
>
>     unset($my_array[$index]);
>
> This leave "holes", which I'm ok with.
>
> To now find the 5th element in this shot-up array I use
>
>     $my_array_piece =  array_splice($my_array, 5, 1);
>
> Is that how you "do" it?
>
> Unfortunately, the "indexes" have meaning.  I don't want to repack.

Oops... I mean array_splice($my_array, 4, 1) for the 5th element
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Parsing .css files with php: Cons?
Next Topic: Open Source Customization
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 28 04:49:35 GMT 2024

Total time taken to generate the page: 0.04544 seconds