Forum Moderators: coopster

Message Too Old, No Replies

result of array diff() into a new sequential array?

         

neophyte

12:32 am on Oct 26, 2006 (gmt 0)

10+ Year Member



Hello All -

I'm successfully able to compare two different arrays with array_diff(). The result of this comparison is, of course, assigned to a new array.

Unfortunatly (for my purposes) the array indeces of the resulting matching items are retained, yet empty:

[a][b][empty][d][empty][empty][g] - and so on.

I'm wondering if there's a built-in function that would sequentially assign all non-empty index items of my array_diff() result to a second array, like:

[a][b][d][g]

I know I can do this with a loop, but am wondering if there's already a function to handle this.

Neophyte

Psychopsia

12:45 am on Oct 26, 2006 (gmt 0)

10+ Year Member



Hi!

Do you need to keep the indexes of the resulting array, or only the values matters?

If is the last case you can use array_values [php.net]

neophyte

2:17 am on Oct 26, 2006 (gmt 0)

10+ Year Member



Psychopsia -

array_values is the PERFECT solution. Thanks so much!

Neophyte