我用$area = $p*$r*$r 代替$area = constant($p)*$r*$r,然后 这个代码不走判断语句。
怎么会不走?你的问题表述不适合清晰。
$r是定义的变量值为1可直接使用.$p为常量,需先用constant取值再做运算