Lucas
Lucas

Reputation: 3715

Reading cookies

When I do:

print_r($_COOKIE[@PATH]);

It returns a nice array:

Array ( ['threads'] => Array ( [12] => Array ( [50] => 1317830223 [1] => 1317785487 [14] => 1317497737 [7] => 1317488004 [9] => 1317485889 [6] => 1317294825 [5] => 1317289974 [4] => 1317288063 ) ) )

But when I do:

print_r($_COOKIE[@PATH]['threads']);

It doesn't print anything... var_dump is also returning NULL.

Whats wrong with that? First print is saying that there is an array like this, but when I try to catch it, script returning null.

Upvotes: 1

Views: 103

Answers (1)

zombat
zombat

Reputation: 94147

Judging by the looks of your array output, your cookie array contains a key named 'threads', not threads. Those quotes are part of the key name, so somewhere you are adding extraneous quotes to the key.

Try print_r($_COOKIE[@PATH]["'threads'"]); to see what I mean.

Upvotes: 1

Related Questions