note 55313 added to function.eval
| From: | thedank at osu1 dot php dot net | Date: | Fri, 29 Jul 2005 23:26:18 +0000 |
| Subject: | note 55313 added to function.eval | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-92745@lists.php.net to get a copy of this message | ||
$foo1 = "the good,<br>";
$foo2 = "the bad,<br>";
$foo3 = "the ugly.";
for ($i=1; $i <=3; $i++)
{
eval("\$_SESSION['myVar$i'] = \$foo".$i.";");
}
//use below to show what's in session:
echo "<h3>SESSION</h3>";
echo "<table border=1 width=50%>";
echo "<tr bgcolor=\"#3399FF\">";
echo "<td><b><font color=\"#FFFFFF\">Variable
Name</font></b></td>";
echo "<td><b><font
color=\"#FFFFFF\">Value</font></b></td></tr>";
while(list($key, $val) = each($_SESSION))
{
echo
"<tr><td>$key</td><td><b>$val</b></td></tr>";
}
echo "</table>";
die();
/*---------------------------------------------------------
Prints:
myVar1 the good,
myVar2 the bad,
myVar3 the ugly.
*/
----
Submitter IP: 64.71.164.2
----
Manual Page -- http://www.php.net/manual/en/function.eval.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+55313
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+55313&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+55313&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+55313&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+55313&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+55313&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+55313&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+55313&report=yes
Search -- http://master.php.net/manage/user-notes.php