开发者

php echo inside if statement [duplicate]

This question already has answers here: Closed 11 years ago.

Possible Duplicate:

echo inside if loop

I am trying to evaluate strings like "0>0.1","0<0.2" etc. suppose $string = "0>0.1" and i write if($string) it is always evaluating it to true since it is a non-empty 开发者_运维技巧string so i tried this way if(echo $string) and this time i am getting an error saying that i cannot echo inside if


You're looking for the eval() function.

if ( eval( $string ) ) {
}

http://php.net/eval


You need to be using eval. Of course, this is very, very dangerous, so use it with caution.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜