note 24342 deleted from function.eval by victor
| From: | victor@php.net | Date: | Sat, 12 Jun 2004 22:39:25 +0000 |
| Subject: | note 24342 deleted from function.eval by victor | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-70998@lists.php.net to get a copy of this message | ||
Note Submitter: phoebebright@spamcop.net
----
Just a simple example of how to get at the values in an array using eval (maybe you can use $$ but I
couldn't work out how).
$fruit['a']='apples';
$fruit['b']='bananas';
$array='fruit';
$e='b';
$v='$z=$'.$array."['".$e."'];";
echo "$v -> ";
eval($v);
echo $z;
The resulting output is:
$z=$fruit['b']; -> bananas