Jump to content
Sign in to follow this  

about vardump and cookie

Recommended Posts


$a = 1;

$a = $a + 1;

$expiry = new DateTime('+1year') ;
setcookie( 'language' , 'EN-GB', $expiry->getTimestamp());


echo "Hello world!";

When i run this in phpstorm , i am getting this output:



array (size=1)

'Phpstorm-aa4c01d' => string 'cc5eb5a0-3c37-42ff-8538-e849091f48c8' (length=36)

Hello world!



how come var_dump does not give me the language and 'EN-GB' as output ?


Share this post

Link to post
Share on other sites

Because $_COOKIE contains the parsed cookies from the request. It does not include new cookies you're trying to set -- which wouldn't make a lot of sense, because you have no idea whether the client will even accept your cookie.

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • 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.