1 (edited by creaturecorp 2005-07-01 02:38)

Topic: Multidimensional Arrays (HELP)

Here is a code example of a multidimensional array:

array(
    'Foo'=>array(
            'foo1',
            'foo2',=>array(
                     'foo1',
                     'foo2',
                     'foo3'),
            'foo3' ),

    'Foo'=>array(
            'foo1',
            'foo2',
            'foo' ),
);

Is it possible to remove the text keys and replace them with descending numbers like below?

array(
    0=>array(
            'foo1',
            'foo2',=>array(
                     'foo1',
                     'foo2',
                     'foo3'),
            'foo3' ),

    1=>array(
            'foo1',
            'foo2',
            'foo' ),
);

The reason for this is I want to input only the number in the database and then later match it up to the original array and retrieve the keys. This way I can use less space in the database.

I'm also thinking that the database size wouldn't increase much with using text instead of numbers. Any opinions?

I don't HAVE a signature, ok?

Re: Multidimensional Arrays (HELP)

Nevermind, I found a solution to this.

$noob=array_keys($val);

//to get the key if you have the value
$skey=key('Digital Art',$noob);

//to return the value if you have the key
$svalue=$noob["$value"];

This can be repeated continuously in multidimensional arrays.

I don't HAVE a signature, ok?