note 96286 deleted from function.eval by danbrown

From: Date: Thu, 18 Feb 2010 17:48:21 +0000
Subject: note 96286 deleted from function.eval by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-166156@lists.php.net to get a copy of this message
Note Submitter: szczepan.krolgmail.c0m ---- <? /* 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; } ?>

« previous php.notes (#166156) next »