note 86779 deleted from function.eval by thiago
| From: | thiago@php.net | Date: | Mon, 03 Nov 2008 16:27:51 +0000 |
| Subject: | note 86779 deleted from function.eval by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-146089@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
Hey Guys!
I'm trying to get Eval() to generate an array for me:
Build my class:
1. class t {
2. var $t = "test";
3. var $h = "host";
4. }
Instantiate it:
5. $t = new t();
Dump the variables:
6. $tr = var_export($t, true);
Get rid of any rubbish added in:
7. $te = explode("array", $tr);
8. unset($te[0]);
Print things out:
9. print("<pre>");
10. $str = " array(". substr($te[1], 1, strlen($te[1]) - 5) .");";
11. $array = eval($str);
12. print_r($array);
It doesn't seem to print anything. When I remove the semicolon held within the $str variable it
errors.