Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mixed up multi-dimensional array

Status
Not open for further replies.

bateman23

Programmer
Mar 2, 2001
145
DE
i've got a multidimensional array. After inserting and removing some things i got it mixed up somehow. It looks like that: (Notice that the second dimension is 0,2,1,3) I need the first two sets of information inside the first two arrays (0 and 1). To make it a bit more clear:

What i got is:

Code:
Array
(
    [0] => Array
        (
            [b][0][/b] => Array
                (
                    [0] => 
                    [1] => Projekt-Nummer
                    [2] => ist gleich
                    [3] => 23
                )

            [b][2][/b] => Array
                (
                    [0] => UND
                    [1] => Angelegt durch
                    [2] => ist gleich
                    [3] => dpu
                )

            [b][1][/b] => Array
                (
                )

            [b][3][/b] => Array
                (
                    [0] => 0
                    [1] => 0
                    [2] => 0
                    [3] => 
                )

        )

)

And what i need is:

Code:
Array
(
    [0] => Array
        (
            [b][0][/b] => Array
                (
                    [0] => 
                    [1] => Projekt-Nummer
                    [2] => ist gleich
                    [3] => 23
                )

            [b][1][/b] => Array
                (
                    [0] => UND
                    [1] => Angelegt durch
                    [2] => ist gleich
                    [3] => dpu
                )
			)
)

How do i get back the regular order (0,1,2,3) of the array?
Any help is greatly appreciated. Thanks in advance,
Daniel Purucker
 
Oh, forgot to mention, that this is caused by using array_values() to reindex the array... But i think i need to use this, because without i get:

Code:
Array
(
    [0] => Array
        (
            [0] => Array
                (
                    [0] => 
                    [1] => Projekt-Nummer
                    [2] => ist gleich
                    [3] => 23
                )

            [1] => Array
                (
                )

            [2] => Array
                (
                    [0] => UND
                    [1] => Angelegt durch
                    [2] => ist gleich
                    [3] => dpu
                )

        )

)

..not that good either. Now i need to get rid of the "empty" [1]....

---------------------------------------
Visit me @:
 
Maybe you could answer a few questions which will help us to understand:
1. How you get the values to begin with? Where do they come from?
2. Why do you need them ordered by value?

Let's start there.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top