简单计算方法
程序员文章站
2022-04-29 17:00:07
...
跳至
<?php function jisuan($m,$rum,$n){ switch($rum){ case '+': echo $r=$m + $n; break; case "-": echo $r=$m - $n; break; case "*": echo $r=$m * $n; break; case "/": echo $r=$m / $n; break; } } jisuan(1,'+',3); echo " "; jisuan(2,'*',5); echo " "; jisuan(12,'/',6);