为什么说"分析错误:语法错误,意外的'print'(T_print)…"?
<?php
//init
$pi = 3.14;
$radius = 15;
$theArea = 0;
//area = 2 pi R
$theArea = $pi * ($radius * $radius)
//output
print ("The area of a circle of radius ".$radius." is " . $theArea);
?>
您忘记在print
之前为语句添加分号
//area = 2 pi R
$theArea = $pi * ($radius * $radius); //here
您也可以使用不带括号的print
,因为它是一种语言构造。
print "The area of a circle of radius " . $radius . " is " . $theArea;
除非您真的想要