在 if 循环中回显 [英] echo inside if loop

查看:28
本文介绍了在 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.

这篇关于在 if 循环中回显的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆