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 #180541 is a reply to message #180534] Mon, 25 February 2013 12:01 Go to previous messageGo to previous message
Captain Paralytic is currently offline  Captain Paralytic
Messages: 204
Registered: September 2010
Karma:
Senior Member
On Feb 24, 3:36 pm, catebekens...@yahoo.com wrote:
>> 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.
>
> Me neither ... :-)
>
> $a = array(1,2,3,4,5,9,8,7,6);
> unset($a[4]);
> print_r($a);
> $ar = array_reverse($a);
> print_r($ar);

If you want to renumber your array without changing the natural order
then use array_merge($a), rather than array_reverse($a). But like the
others here, I urge you to think in terms of collections (where
foreach operates), rather than numeric array indexes.
[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 13:33:49 GMT 2024

Total time taken to generate the page: 0.04341 seconds