note 55372 deleted from function.unset by nlopess

From: Date: Mon, 01 Aug 2005 17:59:43 +0000
Subject: note 55372 deleted from function.unset by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-92881@lists.php.net to get a copy of this message
Note Submitter: the question ---- In the below snippet, $var1, $var2 and $var3 are set using: eval("\$var$i = \$i;"); How can these vars be UNSET dynamically? Eg something like : unset (eval("\$var$i;")); This is a very simple version of a script in which _SESSION vars are created in a loop, and I need to unset them later. MANY THANKS TO ANYONE WHO CAN SOLVE THIS ONE --------------------------------------- for ($i=1; $i<=3; $i++) { eval("\$var$i = \$i;"); echo "$i<br>"; echo "var1: $var1<br>"; echo "var2: $var2<br>"; echo "var3: $var3<hr>"; } echo "<hr><hr>"; for ($i=1; $i<=3; $i++) { unset($var1); echo "$i<br>"; echo "var1: $var1<br>"; echo "var2: $var2<br>"; echo "var3: $var3<hr>"; } die();

« previous php.notes (#92881) next »