douda5227 2016-10-07 18:14
浏览 70

在CodeIgniter中在没有Eval的情况下评估php中的表达式

I've stored an expression in a database, e.g.:

$expression = (({TENOR} <= 90) AND ({DEPOSIT_AMOUNT} > 0) AND {PENALTY_BASIS} = 0 )

I want to evaluate the expression in an IF...Else statement and get the results

if ($expression) {action} else {other action}

What is the best way to achieve the result? I've tried

$this->parser->parse_string($string, $data, TRUE);

but the output is always a string, hence if...else statement outputs TRUE every time.

  • 写回答

1条回答 默认 最新

  • dsykx64220 2016-10-08 18:02
    关注

    I found out a solution at previously answered post here

    The library can be found out at here

    Thanks all for the help...

    评论

报告相同问题?

悬赏问题

  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 matlab有关常微分方程的问题求解决
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?
  • ¥100 求三轴之间相互配合画圆以及直线的算法
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考