Setting all cookies to variables?
<p>I'm trying to set all active cookies to variables in which the names would correspond to the name of the cookie, which I tried to accomplish using a variable variable. <a href="http://php.net/manual/en/language.variables.variable.php" rel="nofollow">http://php.net/manual/en/language.variables.variable.php</a></p>

<pre><code>function setcookie_vars() {
    if(isset($_SERVER["HTTP_COOKIE"])) {
        $cookies = explode(";", $_SERVER["HTTP_COOKIE"]);
        foreach($cookies as $cookie) {
            $parts = explode("=", $cookie);
            $name = trim($parts[0]);
            $value = trim($parts[1]);
            $$name = $value;
            return $$name;
        }
    }
}
print_r(${$test}); // should output the value for $_COOKIE["test"];
</code></pre>

<p>For instance, if the cookie's name was "test," the variable's name would be $test with the same value set in the cookie for that name. I tried to test this out with cookies set beforehand and I got (and I checked that the cookie was already set):</p>

<pre><code>    Notice: Undefined variable: test in...
    Notice: Undefined variable: in...
</code></pre>

<p>I was unable to find any problem similar to this on the web, probably because it's fairly customized.</p>
