Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想知道如何将条件赋值分配给 php 变量并在其他条件中使用它,如下所示:
$cndtnal='&& $x==4' if($y==5 $cndtnal){ print 'Hello World'; }
谢谢。
你应该尽量避免使用eval,但是如果你想使用它,那么你可以这样做:
$cndtnal='&& $x=4'; if($y==5 .eval("return '$cndtnal';") ){ echo 'Hello World'; } else { echo "this"; }