note 86779 added to function.eval

From: Date: Mon, 03 Nov 2008 16:27:11 +0000
Subject: note 86779 added to function.eval
Groups: php.notes 
Request: Send a blank email to php-notes+get-146088@lists.php.net to get a copy of this message
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. ---- Server IP: 92.48.74.199 Probable Submitter: 83.138.138.174 ---- Manual Page -- http://www.php.net/manual/en/function.eval.php Edit -- https://master.php.net/note/edit/86779 Del: integrated -- https://master.php.net/note/delete/86779/integrated Del: useless -- https://master.php.net/note/delete/86779/useless Del: bad code -- https://master.php.net/note/delete/86779/bad+code Del: spam -- https://master.php.net/note/delete/86779/spam Del: non-english -- https://master.php.net/note/delete/86779/non-english Del: in docs -- https://master.php.net/note/delete/86779/in+docs Del: other reasons-- https://master.php.net/note/delete/86779 Reject -- https://master.php.net/note/reject/86779 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#146088) next »