Array Problem[SOLVED]

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Mohamed
Forum Newbie
Posts: 21
Joined: Fri Jan 19, 2007 6:59 pm
Location: Seattle

Array Problem[SOLVED]

Post by Mohamed »

hi all
I have a array and I want to reindex(remove integer keys) it. so how can I do it,
I get the array in this format.

Code: Select all

Array
(
    [0] => Array
        (
            [0] => Array
                (
                    [id] => init_7857_1171540372
                    [fileid] => init_2937_1171290246
                    [title] => Java Exceptions
                    [description] => course for exception handling
                    [creatorid] => 3030070212
                    [datecreated] => 2007-02-15 13:52:52
                    [modifierid] => 3030070212
                    [datemodified] => 2007-02-15 15:38:43
                    [puid] => 8
                )

        )

)
how I want it to look like.

Code: Select all

Array
        (
            [id] => init_7857_1171540372
            [fileid] => init_2937_1171290246
            [title] => Java Exceptions
            [description] => course for exception handling
            [creatorid] => 3030070212
            [datecreated] => 2007-02-15 13:52:52
            [modifierid] => 3030070212
            [datemodified] => 2007-02-15 15:38:43
            [puid] => 8
        )
Last edited by Mohamed on Fri Feb 16, 2007 12:34 pm, edited 1 time in total.
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

$array = $array[0][0] might work. If not:

Code: Select all

$i=0;
foreach($array as $array0) foreach($array0 as $array00)
{$array[$i] = $array00[$i]; $i++;}
Post Reply