<?php
$r['crime']= (string)print("hello world");
$input = "\$sucrate=" . str_ireplace(array("LEVEL", "EXP", "WILL", "IQ"), array(1,2,3,4), $r['crime']) . ";";
$tokens = token_get_all("<?php {$input}");
$expr = '';
foreach($tokens as $token){
if(is_string($token)){
if(in_array($token, array('(', ')', '+', '-', '/', '*'), true))
$expr .= $token;
continue;
}
list($id, $text) = $token;
if(in_array($id, array(T_DNUMBER, T_LNUMBER)))
$expr .= $text;
}
eval("\$result = {$expr};");
print "\nexpr = " . $expr;
print "\nres = " . $result;
preferences:
24.27 ms | 406 KiB | 5 Q