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

查看:89
本文介绍了在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天全站免登陆