Re: unset multidimensional array element [message #180542 is a reply to message #180534] |
Mon, 25 February 2013 16:13 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma:
|
Senior Member |
|
|
On 2/24/2013 10:36 AM, catebekensail(at)yahoo(dot)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);
>
Which renumbers the indexes in the array.
The real question here is - WHY do you think you need the keys renumbered?
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|