note 96286 added to function.eval
| From: | szczepan dot krolgmail dot c0m at osu1 dot php dot net | Date: | Thu, 18 Feb 2010 17:00:17 +0000 |
| Subject: | note 96286 added to function.eval | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-166155@lists.php.net to get a copy of this message | ||
<?
/*
Use this function to make an evalstring visible
Example:
$five=5;
$six=6;
$eval="\$results=\$five+\$six;";
$eval_new=evalLook($eval)
changed to:
$results=5+6;
Maybe need this for a debugging in your Script
*/
$five=5;
$six=6;
$eval="\$results=\$five+\$six;";
echo $look=evalLook($eval); #prints "$results=5+6;"
function evalLook($evalstring){
#Search for $strings, even for classstrings
$reg='(\$([A-z0-9_]+(\->)?)+(\[[\'"][0-9A-z_]+[\'"]\])?)';
preg_match_all($reg,$evalstring,$res);
$eval2=$evalstring;
foreach($res['0'] as $val){
eval('global '.$val.';$main='.$val.';');
# eval('echo $main;');
if($main==''){continue;}
$eval2 =str_replace($val,$main,$eval2);
}
return $eval2;
}
?>
----
Server IP: 212.124.37.9
Probable Submitter: 78.52.165.36
----
Manual Page -- http://www.php.net/manual/en/function.eval.php
Edit -- https://master.php.net/note/edit/96286
Del: integrated -- https://master.php.net/note/delete/96286/integrated
Del: useless -- https://master.php.net/note/delete/96286/useless
Del: bad code -- https://master.php.net/note/delete/96286/bad+code
Del: spam -- https://master.php.net/note/delete/96286/spam
Del: non-english -- https://master.php.net/note/delete/96286/non-english
Del: in docs -- https://master.php.net/note/delete/96286/in+docs
Del: other reasons-- https://master.php.net/note/delete/96286
Reject -- https://master.php.net/note/reject/96286
Search -- https://master.php.net/manage/user-notes.php