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

Home » Imported messages » comp.lang.php » unset multidimensional array element
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: unset multidimensional array element [message #180533 is a reply to message #180526] Sun, 24 February 2013 13:40 Go to previous messageGo to previous message
M. Strobel is currently offline  M. Strobel
Messages: 386
Registered: December 2011
Karma:
Senior Member
Am 24.02.2013 01:18, schrieb cate:
> Is this correct?
>
> I remove an element from a multidee array. Numeric Indexing then
> fails because the it's no longer 0, 1, 2 but instead 0, 2 after the
> unset. It seems the a numeric index has graduated to a key. (I
> think I read that's the way php works)
>
> Do I have to repack this to get sequential indexing to work or is
> there a php way to remove elements and maintain a "numeric" indexs?
>
> I suppose I could make it a rule to use the construct foreach, but I
> do so love for(;;).
>
> Thank you in advance.
>
>
> array (
> array (1, 2, 3),
> array (4, 5, 6),
> array (7, 8, 9)
> )
>
This is the behaviour PHP programmers IMO like. Imagine you have a unique database
key as index, I would not like it to be renumbered after deletion of one entry.

/Str.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: preg_replace... I can't do it!!
Next Topic: simpletest vs phpunit vs ...
Goto Forum:
  

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

Current Time: Wed Nov 27 15:46:13 GMT 2024

Total time taken to generate the page: 0.04113 seconds