Re: eval help
| From: | neko | Date: | Mon, 03 Mar 2003 14:09:47 +0000 |
| Subject: | Re: eval help | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-137887@lists.php.net to get a copy of this message | ||
note that the following php:
<?php
/*
eval testing
SM 3/3/2003 1:28PM
*/
$name = "Scott";
$arr[] = "Dude";
$arr2["name"] = "Broness!";
echo($arr2['name']); // test
$str = "<br>Hello, $name";
$str2 = "<br>Hello, $arr[0]";
$str3 = "<br>Hello, $arr2['name']";
eval ("\$evaldString = \"$str\";");
echo $evaldString;
eval ("\$evaldString = \"$str2\";");
echo $evaldString;
eval ("\$evaldString = \"$str3\";");
echo $evaldString;
?>
produces:
Broness!<br>Hello, Scott<br>Hello, Dude<br>Hello,
--
note that the last cannot be seen - I'm sure I'm almost there, but I have to
be able to reference an associative array.
Scott