求救哪裡打錯了?

edited 八月 2014 in PHP新手區
<?php
	
	class CircleCal 
	{
		//屬性
		var float $r;
		var float $area=r*r*M_PI;
		var float $lengh=2*r*M_PI;
		
		//方法
		function count()
		{
			if($r>=0)
			{
				echo "area =".$this->area."<br />";
				echo “lengh =:".$this->lengh."<br />";
			}
			else
			{
				echo "無法計算";
			}
		}
	}
	//物件化
	$o1 = new CircleCal();
	//给 $p1 物件屬性賦值
	$o1->r = 10;
	$o1->count();
?>

評論

Sign In or Register to comment.