[EMAIL PROTECTED] sagde:
>
> Hi,
> I have variables called Cookie1 to Cookie35.
>
> I would like to print the values of  Cookie1 to Cookie35 using for loop.
>
> Could anybody correct the below code to print the variables.
>
> =============================for($i=1;$i<34;$i++)
> {
>       $x="Cookie".$i;
>
>       if(isset($$x))
>       {
>               echo "<p>$x:$$x</p>";
>       }
> }


for($i=1;$i<34;$i++)
{
        $x="Cookie".$i;
        eval("\$y = \$$x;");
        if(isset($y))
        {
                echo "<p>$x:$y</p>";
        }
}

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to