Jump to content

[SOLVED] can you use unset() on multidimentional arrays? it doesn't seem to work


Zaid

Recommended Posts

That is invalid call to an array element:

$GLOBALS['cookie_array_full[0][$key]']

 

It should like this:

$GLOBALS['cookie_array_full'][0][$key]

 

still doesn't work :(

 

i got it to work but using a different syntax:

unset($this->cookie_array_full[0][$key]);

What is the format of the $GLOBALS['cookie_array_full'] array?

 

To see the format of $GLOBALS['cookie_array_full'] array use print_r, example:

 

echo '<pre>' . print_r($GLOBALS['cookie_array_full'], true) . '</pre>';

What is the format of the $GLOBALS['cookie_array_full'] array?

 

To see the format of $GLOBALS['cookie_array_full'] array use print_r, example:

 

echo '<pre>' . print_r($GLOBALS['cookie_array_full'], true) . '</pre>';

 

Array
(
    [0] => Array
        (
            [0] => 3
            [1] => 65
        )

    [1] => Array
        (
        )

)

i've read that unset will work inside a function, but will only change it locally, even when the array is a global array

and therefore i should use $GLOBALS, but i guess it doesn't work

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.