Jump to content

reorder the index values of an array


Giddy Rob

Recommended Posts

Hi,

 

I have an array of items and I need to reset the index values when one has been deleted. For example - if I have a sequence of

 

0 => a

1 => b

2 => c

3 => d

4 => e

 

and 2 is deleted from the array it shifts all the records up so that I am left with:

 

0 => a

1 => b

2 => d

3 => e

 

I need this as I am outputting using a for loop which counts the items from 0 up to how many are in the array.

 

Anyone got a clue?

 

Cheers in advance guys.

 

Rob

Link to comment
https://forums.phpfreaks.com/topic/107488-reorder-the-index-values-of-an-array/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.