Suppose you use a subcookie, which is a way to save multiple variables in the same cookie:
cookiename=name1=value1&name2=value2&name3=value3
Is there a built in php function that could parse such a query string?
I was not familiar with the use of subcookies until I went here:
YUI 2: Cookie Utility (scroll down to the bottom)
figured it out
use urlencode, or http_build_query to create a sub cookie string,
then use parse_str() to get the variables.
echo $string = http_build_query(array(‘name’ => ‘test’, ‘last’ => ‘user’));
parse_str($string);
echo $name;
echo $last;
This is not an optimal solution because with parse_str() from user submitted data would allow just anyone to create whatever variables they wanted.