On Tuesday 15 June 2004 14:14, [EMAIL PROTECTED] wrote: > 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>"; > } > } > ==============================
You've gotten several answers for this already. But you really should be using arrays rather than variable variables. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* You single-handedly fought your way into this hopeless mess. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php