Home  >  Article  >  Backend Development  >  PHP 字符串轮换后不能运算

PHP 字符串轮换后不能运算

WBOY
WBOYOriginal
2016-06-13 11:10:42809browse

PHP 字符串替换后不能运算
由于把公式写在数据库中:
如 $gongshi="a+b+c";
前台做替换
如a=3;b=4;c=5;
$gongshi=str_ireplace("3","a",$gongshi);
$gongshi=str_ireplace("4","b",$gongshi);
$gongshi=str_ireplace("5","c",$gongshi);
替换成功
3+4+5不能自动计算,该怎么办?


------解决方案--------------------
eval()
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn