Its not echoing the COOKIE instead shows an error.
Error:Undefined index: pref[fontSize]
setcookie('pref[fontSize]',25);
setcookie('pref[favCategory]','news');
setcookie('pref[screenWidth]',1024);
echo $_COOKIE['pref[fontSize]'];
The documentation for setCookie, suggests that $_COOKIE will not hold vals from setCookie, till after the cookie has been set client side (e.g. next request, because the user might have their browser configured to not save cookies).
var_dump($_COOKIE);?array(2) { ["pref"]=> array(3) { ["fontSize"]=> string(2) "25" ["favCategory"]=> string(4) "news" ["screenWidth"]=> string(2) "25" } ["PHPSESSID"]=> string(26) "5mr3d4tt3uab6kdkal0blt1qt2" }