$b = 2;
$c = "+";
$d = 3;
eval("\$a=$b$c$d;");
$c = "+";
$d = 3;
eval("\$a=$b$c$d;");
注意:如果有复杂运算,先在外面做好运算,再带进eval
例如:
$current=$currSheet->getCell($posarr[$j])->getValue();
$fuhao=$posfuhao[0][$j-1];
eval("\$cellValue$fuhao=$current;");
不能直接写在一行