在 if 循环中回显
问题描述:
我有一个这样的变量
$string = "0>0.1";
我想在这样的 if 循环中评估这个
I want to evaluate this inside an if loop like this
if($string)
{
///something
}
但是如果我这样做,我会出错.怎么办
but im getting an error if i am doing this. How to go about it
答
您可以使用 eval
评估字符串中的内容.请记住,eval
是邪恶的,任何 php 代码都可能在其中.
You can use eval
to evaluate things in strings. Remember that eval
is evil and any php code may be in it.