使用两个函数时获取解析错误

时间:2014-03-24 19:35:56

标签: php

我正在尝试使用Call By Reference编写程序来计算区域,但我得到了一个Parse Error: -

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

现在我,想不通为什么会这样?

<?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 个答案:

答案 0 :(得分:1)

你错误拼写的功能:

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

应该是

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