calculate Cookie Size in PHP -


i wanted read cookie , calculate length on server side using php, can't find direct method so. how achieve task ?

what ?

setcookie("user", "dino babu kannampuzha", time() + 3600);  if (isset($_cookie["user"])) {   $data = $_cookie["user"];   $serialized_data = serialize($data);   $size = strlen($serialized_data);   echo 'length : ' . strlen($data);   echo "<br/>";   echo 'size : ' . ($size * 8 / 1024) . ' kb'; } 

// output

length : 21 size : 0.232 kb 

Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -