Zaid Posted April 8, 2007 Share Posted April 8, 2007 btw, im trying to use unset() from inside a method class cookie(){ public $cookie_array_full; function blahblah($key){ unset($GLOBALS['cookie_array_full[0][$key]']); } } any idea why it doesn't work? Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted April 8, 2007 Share Posted April 8, 2007 That is invalid call to an array element: $GLOBALS['cookie_array_full[0][$key]'] It should like this: $GLOBALS['cookie_array_full'][0][$key] Quote Link to comment Share on other sites More sharing options...
Zaid Posted April 8, 2007 Author Share Posted April 8, 2007 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]); Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted April 8, 2007 Share Posted April 8, 2007 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>'; Quote Link to comment Share on other sites More sharing options...
Zaid Posted April 8, 2007 Author Share Posted April 8, 2007 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.