duanbi1983 2014-03-24 19:35
浏览 18
已采纳

使用两个函数时出现解析错误[关闭]

I am trying to write a program using Call By Reference to calculate the area but I am getting a Parse Error :-

Parse error: syntax error, unexpected 'ar' (T_STRING) in C:\xampp\htdocs\workspace.php on line 7

Now I, cannot think why it is happening?

<?php
function perimeter(&$l,&$b,&$result)
{ 
$result=2*($l+$b);
}

funtction ar(&$le,&$br,&$result1)
{
$result1=$le*$br;
}
$result=1;
$length=$_GET['length'];
$breadth=$_GET['breadth'];
echo "<h1><center>Area And Perimeter Calculator Using Call By Reference</h1></center>";
$result = perimeter($length,$breadth,$result);
echo "<br />The Perimeter Of The Rectangle Is <strong>$result</strong>";
$result= ar($length,$breadth,$result);
echo "<br /><br />The Area Of The Rectangle Is = <strong>$result</strong>";
?>
  • 写回答

1条回答 默认 最新

  • douzen1896 2014-03-24 19:36
    关注

    You misspelled function:

      funtction ar(&$le,&$br,&$result1)
      {
       $result1=$le*$br;
      }
    

    should be

      function ar(&$le,&$br,&$result1)
      {
       $result1=$le*$br;
      }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?