Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert string to conditional expression in PHP?

I have string like this,

$condition = "if($test == '1')";

I want to convert it to a conditional expression without using eval().

Is it possible?

like image 252
japt Avatar asked Nov 12 '22 09:11

japt


1 Answers

Take a look at $functionName() or call_user_func($functionName)

More clarification.

like image 55
Dipesh Parmar Avatar answered Nov 15 '22 06:11

Dipesh Parmar