Executing a string in PHP -


i have requirement have conditions saved in db. able bring conditions via php code, not able execute them. have shown 1 example below.

<?   $z = ">100";//i value db $x = 80; // value comes db  if(exec("&1 &2",$x,$z))   echo "yes"; else   echo "no"; ?> 

also tried this

<?   $z = ">100"; $x = 80; if(eval("$x $z"))   echo "yes"; else   echo "no"; ?> 

it should be, ( eval accepts statements, not expressions)

$z = ">100";//i value db $x = 80; // value comes db   if(eval("return {$x} {$z};"))   echo "yes"; else   echo "no"; ?> 

Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -