Jump to content

Recommended Posts

WARNING: I know this is a MASSIVE function to proofread, so don't feel obligated to help  ;D.

 

Parse error: syntax error, unexpected '{' in C:\Program Files\Apache Group\Apache2\htdocs\hypotenuse.php on line 470

 


function SSA($side, $angle)
{
$pi = define_pi();




if (empty($side[0]))
{
	if (empty($angle[1])
	{                                                              ////Line 470
		if ($angle[2] > ($pi/2)) 
		{
			if ($side[2] <= $side[1])
			{
			echo "No solution because 'side c is less than or equal to side b'.";
			}

			if ($side[2] > $side[1])
			{
			$angle[1] = asin(($side[1]*sin($angle[2]))/$side[2])
			$angle[0] = $pi - $angle[1] - $angle[2];
			$side[0] = (($side[2]*sin($angle[0]))/sin($angle[2]);
			}

		}

		elseif ($angle[2] < ($pi/2))
		{

			$height = $side[1]*sin($angle[2]);

			if ($side[2] < $height)
				{
				echo "No solution, the swinging side (c) is shorter than the height.";
				}

			elseif ($side[2] > $height && $side[2] < $side[1])
				{
				echo "Two solutions, h < c < b.";
				$angle[1] = asin(($side[1]*sin($angle[2]))/$side[2]);
				$angle[0] = $pi - $angle[2] - $angle[1];
				$angle_b2 = $pi - $angle[1];
				$angle_a2 = $pi  - $angle[2] - $angle_b2;
				$side_a2 = sqrt((($side[1]*$side[1]) + ($side[2]*$side[2])))-(2*$side[1]*$side[2]*cos($angle_a2)));
				$side[0] = (($side[1]*sin($angle[0]))/sin($angle[1]);
				}

			elseif ($side[2] > $height && $side[2] > $side[1])
				{
				echo "One solution, c > h and c > b.";

				$angle[1] = asin(($side[1]*sin($angle[2]))/$side[2]);
				$angle[0] = $pi - $angle[1] - $angle[2];
				$side[0] = sqrt(($side[1]*$side[1] + $side[2]*$side[2])-(2*$side[1]*$side[2]*cos($angle[0])));
				}

			elseif ($side[2] == $height)
				{
				echo "One solution, c = height.";

				$angle[1] = ($pi/2);
				$angle[0] = $pi - $angle[1] - $angle[2];
				$side[0] = $side[2]*tan($angle[0]);
				}

		}

			elseif ($angle[2] == ($pi/2))
			{
			echo "One solution, Angle B is 90 degrees.";

			$angle[1] = $pi/2
			$angle[0] = $pi - $angle[2] - $angle[1];
			$side[0] = sqrt(($side[1]*$side[1]) - ($side[2]*$side[2]));
			}
		}
	}

	elseif (empty($angle[2])
	{
		if ($angle[1] > ($pi/2)) 
		{
			if ($side[1] <= $side[2])
			{
			echo "No solution because 'side b is less than or equal to side c'.";
			}

			if ($side[1] > $side[2])
			{
			echo "One Solution, b > c.";

			$angle[2] = asin(($side[2]*sin($angle[1]))/$side[1]);
			$angle[0] = $pi - $angle[1] - $angle[2];
			$side[0] = (($side[1]*sin($angle[0]))/sin($angle[1]);
			}

		}

		elseif ($angle[1] < ($pi/2))
		{

		$height = $side[2]*sin($angle[1]);

			if ($side[1] < $height)
				{
				echo "No solution, the swinging side (b) is shorter than the height.";
				}

			elseif ($side[1] > $height && $side[1] < $side[2])
				{
				echo "Two solutions, h < b < c.";
				$angle[2] = asin(($side[2]*sin($angle[1]))/$side[1]);
				$angle[0] = $pi - $angle[1] - $angle[2];
				$angle_c2 = $pi - $angle[2];
				$angle_a2 = $pi  - $angle[1] - $angle_c2;
				$side_a2 = sqrt((($side[1]*$side[1] + ($side[2]*$side[2]))-(2*$side[1]*$side[2]*cos($angle_a2)));
				$side[0] = sqrt((($side[1]*$side[1] + ($side[2]*$side[2]))-(2*$side[1]*$side[2]*cos($angle[0])));
				}

			elseif ($side[1] > $height && $side[1] > $side[2])
				{
				echo "One solution, b > h and b > c.";

				$angle[2] = asin(($side[2]*sin($angle[1]))/$side[1]);
				$angle[0] = $pi - $angle[1] - $angle[2];
				$side[0] = sqrt()($side[1]*$side[1] + ($side[2]*$side[2]))-(2*$side[1]*$side[2]*cos($angle[0])));
				}

			elseif ($side[1] == $height)
				{
				echo "One solution, b = height.";

				$angle[2] = ($pi/2);
				$angle[0] = $pi - $angle[2] - $angle[1];
				$side[0] = sqrt(($side[2]*$side[2]) - ($side[1]*$side[1]));
				}
			}

			elseif ($angle[1] == ($pi/2))
			{
			echo "One Solution, Angle B is 90 degrees.";

			$angle[2] = asin($side[2]/$side[1]);
			$angle[0] = $pi - $angle[1] - $angle[2];
			$side[0] = sqrt(($side[1]*$side[1]) - ($side[2]*side[2]));
			}
	  } 
}




elseif (empty($side[1]))
{
	if (empty($angle[0])
	{
		if ($angle[2] > ($pi/2)) 
		{
			if ($side[2] <= $side[0])
			{
			echo "No solution because 'side a is less than or equal to side c'.";
			}

			if ($side[2] > $side[0])
			{
			$angle[0] = asin(($side[0]*sin($angle[2]))/$side[2])
			$angle[1] = $pi - $angle[0] - $angle[2];
			$side[1] = (($side[1]*sin($angle[2]))/sin($angle[2]);
			}

		}

		elseif ($angle[2] < ($pi/2))
		{

		$height = $side[0]*sin($angle[2]);

			if ($side[2] < $height)
				{
				echo "No solution, the swinging side (c) is shorter than the height.";
				}

			elseif ($side[2] > $height && $side[2] < $side[0])
				{
				echo "Two solutions, h < c < a.";
				$angle[0] = asin(($side[0]*sin($angle[2]))/$side[2]);
				$angle[1] = $pi - $angle[0] - $angle[2];
				$angle_a2 = $pi - $angle[0];
				$angle_b2 = $pi  - $angle[2] - $angle_a2;
				$side_b2 = sqrt((($side[0]*$side[0]) + ($side[2]*$side[2]))-(2*$side[0]*$side[2]*cos($angle_b2)));
				$side[1] = (($side[2]*sin($angle[1]))/sin($angle[2]);
				}

			elseif ($side[2] > $height && $side[2] >= $side[0])
				{
				echo "One solution, c > h and c > a.";

				$angle[0] = asin(($side[0]*sin($angle[2]))/$side[2]);
				$angle[1] = $pi - $angle[0] - $angle[2];
				$side[1] = sqrt((($side[0]*$side[0]) + ($side[2]*$side[2]))-(2*$side[0]*$side[2]*cos($angle[1])));
				}

			elseif ($side[2] == $height)
				{
				echo "One solution, c = height.";

				$angle[0] = ($pi/2);
				$angle[1] = $pi - $angle[0] - $angle[2];
				$side[1] = $side[2]*tan($angle[1]);
				}
			}

		elseif ($angle[2] == ($pi/2))
			{
			echo "One solution, Angle  is 90 degrees.";
			$side[1] = sqrt(($side[2]*$side[2]) - ($side[0]*$side[0]));
			$angle[0] = asin(($side[0]*sin($angle[2])/$side[2]);
			$angle[1] = $pi - $angle[0] - $angle[2];
			}
		}
	}


	elseif (empty($angle[2])
	{
		if ($angle[1] > ($pi/2)) 
		{
			if ($side[1] <= $side[2])
			{
			echo "No solution because 'side  is less than or equal to side '.";
			}

			if ($side[1] > $side[2])
			{
			echo "One Solution, b > c.";

			$angle[2] = asin(($side[2]*sin($angle[1]))/$side[1]);
			$angle[0] = $pi - $angle[1] - $angle[2];
			$side[0] = (($side[0]*sin($angle[2]))/sin($angle[2]);
			}

		}

		elseif ($angle[1] < ($pi/2))
		{

		$height = $side[2]*sin($angle[1]);

			if ($side[1] < $height)
				{
				echo "No solution, the swinging side () is shorter than the height.";
				}

			elseif ($side[1] > $height && $side[1] < $side[2])
				{
				echo "Two solutions, h < b < c.";
				$angle[2] = asin(($side[2]*sin($angle[1]))/$side[1]);
				$angle[0] = $pi - $angle[1] - $angle[2];
				$angle_c2 = $pi - $angle[2];
				$angle_a2 = $pi  - $angle[1] - $angle_c2;
				$side_a2 = sqrt(($side[1]*$side[1] + $side[2]*$side[2])-(2*$side[1]*$side[2]*cos($angle_a2));
				$side[0] = sqrt(($side[1]*$side[1] + $side[2]*$side[2])-(2*$side[1]*$side[1]*cos($angle[0]));
				}

			elseif ($side[1] > $height && $side[1] >= $side[2])
				{
				echo "One solution, b > h and b > c.";

				$angle[2] = asin(($side[2]*sin($angle[1]))/$side[1]);
				$angle[0] = $pi - $angle[1] - $angle[2];
				$side[0] = sqrt(($side[1]*$side[1] + $side[2]*$side[2])-(2*$side[1]*$side[2]*cos($angle[0]));
				}

			elseif ($side[1] == $height)
				{
				echo "One solution, b = height.";

				$angle[2] = ($pi/2);
				$angle[0] = $pi - $angle[1] - $angle[2];
				$side[0] = sqrt(($side[2]*$side[2]) - ($side[1]*$side[1]));
				}
			}

		elseif ($angle[1] == ($pi/2))
			{
			echo "One Solution, Angle B is 90 degrees.";

			$angle[2] = asin($side[2]/$side[1]);
			$angle[0] = $pi - $angle[1] - $angle[2];
			$side[0] = sqrt(($side[1]*$side[1]) - ($side[2]*side[2]));
			}
	}
}




elseif (empty($side[2]))
{
	if (empty($angle[0])
	{
		if ($angle[1] > ($pi/2)) 
		{
			if ($side[1] <= $side[0])
			{
			echo "No solution because 'side b is less than or equal to side a'.";
			}

			if ($side[1] > $side[0])
			{
			$angle[0] = asin(($side[0]*sin($angle[1]))/$side[1])
			$angle[2] = $pi - $angle[0] - $angle[1];
			$side[2] = (($side[1]*sin($angle[2]))/sin($angle[1]);
			}

		}

		elseif ($angle[1] < ($pi/2))
		{

		$height = $side[0]*sin($angle[1]);

			if ($side[1] < $height)
				{
				echo "No solution, the swinging side (b) is shorter than the height.";
				}

			elseif ($side[1] > $height && $side[1] < $side[0])
				{
				echo "Two solutions, h < b < a .";
				$angle[0] = asin(($side[0]*sin($angle[1]))/$side[1]);
				$angle[2] = $pi - $angle[1] - $angle[0];
				$angle_a2 = $pi - $angle[0];
				$angle_c2 = $pi  - $angle[1] - $angle_a2;
				$side_c2 = sqrt((($side[0]*$side[0]) + ($side[1]*$side[1]))-(2*$side[0]*$side[1]*cos($angle_c2)));
				$side[2] = sqrt(($side[1]*$side[1] + $side[0]*$side[0])-(2*$side[1]*$side[0]*cos($angle[2]));
				}

			elseif ($side[] > $height && $side[] >= $side[])
				{
				echo "One solution, b > h and b > a.";

				$angle[0] = asin(($side[0]*sin($angle[1]))/$side[1]);
				$angle[2] = $pi - $angle[1] - $angle[0];
				$side[2] = sqrt((($side[1]*$side[1]) + ($side[0]*$side[0]))-(2*$side[1]*$side[0]*cos($angle[2])));
				}

			elseif ($side[1] == $height)
				{
				echo "One solution, b = height.";

				$angle[0] = ($pi/2);
				$angle[2] = $pi - $angle[1] - $angle[0];
				$side[2] = sqrt(($side[0]*$side[0]) - ($side[1]*$side[1]));
				}
			}

		elseif ($angle[1] == ($pi/2))
			{
			echo "One solution, Angle B is 90 degrees.";
			$side[2] = sqrt(($side[1]*$side[1]) - ($side[0]*$side[0]));
			$angle[0] = asin(($side[0]*sin($angle[1])/$side[1]);
			$angle[2] = $pi - $angle[1] - $angle[0];
			}
		}
	}

	elseif (empty($angle[1])
	{
		if ($angle[0] > ($pi/2)) 
		{
			if ($side[0] <= $side[1])
			{
			echo "No solution because 'side a is less than or equal to side b'.";
			}

			if ($side[0] > $side[1])
			{
			echo "One Solution, a > b.";

			$angle[1] = asin(($side[1]*sin($angle[0]))/$side[0]);
			$angle[2] = $pi - $angle[1] - $angle[0];
			$side[2] = (($side[0]*sin($angle[2]))/sin($angle[0]);
			}

		}

		elseif ($angle[0] < ($pi/2))
		{

		$height = $side[1]*sin($angle[0]);

			if ($side[0] < $height)
				{
				echo "No solution, the swinging side (a) is shorter than the height.";
				}

			elseif ($side[0] > $height && $side[0] < $side[1])
				{
				echo "Two solutions, h < a < c.";
				$angle[1] = asin(($side[1]*sin($angle[0]))/$side[0]);
				$angle[2] = $pi - $angle[0] - $angle[1];
				$angle_b2 = $pi - $angle[1];
				$angle_c2 = $pi  - $angle[0] - $angle_b2;
				$side_c2 = sqrt(($side[1]*$side[1] + $side[0]*$side[0])-(2*$side[1]*$side[0]*cos($angle_c2));
				$side[2] = sqrt(($side[1]*$side[1] + $side[0]*$side[0])-(2*$side[0]*$side[1]*cos($angle[2]));
				}

			elseif ($side[0] > $height && $side[0] >= $side[1])
				{
				echo "One solution, a > h and a > b.";

				$angle[1] = asin(($side[1]*sin($angle[0]))/$side[0]);
				$angle[2] = $pi - $angle[0] - $angle[1];
				$side[2] = sqrt(($side[1]*$side[1] + $side[0]*$side[0])-(2*$side[0]*$side[1]*cos($angle[2]));
				}

			elseif ($side[0] == $height)
				{
				echo "One solution, a = height.";

				$angle[1] = ($pi/2);
				$angle[2] = $pi - $angle[1] - $angle[0];
				$side[2] = sqrt(($side[1]*$side[1]) - ($side[0]*$side[0]));
				}
			}

		elseif ($angle[0] == ($pi/2))
			{
			echo "One Solution, Angle A is 90 degrees.";

			$angle[1] = asin($side[1]/$side[0]);
			$angle[2] = $pi - $angle[0] - $angle[1];
			$side[2] = sqrt(($side[0]*$side[0]) - ($side[1]*side[1]));
			}

	 }


}

 

I keep looking and I keep counting the {}.  Every time I think that I don't have one, I can't seem to find the problem.

 

If it isn't a bracket issue...that would be GREAT!

 

Thanks in Advance

Link to comment
https://forums.phpfreaks.com/topic/73023-solved-parse-error-with-massive-function/
Share on other sites

 

Parse error: syntax error, unexpected '{' in C:\Program Files\Apache Group\Apache2\htdocs\hypotenuse.php on line 470

 

sometimes that message means you missed something before that {

eg.. if (isset(missing){ you missed ) please check that

 

unexpected { because it should be ) not {

 

hope that the error ididnt look at your codes  ;D

<?php

function SSA($side, $angle)
{
$pi = define_pi();




if (empty($side[0]))
{
	if (empty($angle[1])
	{                                                              ////Line 470
		if ($angle[2] > ($pi/2)) 
		{
			if ($side[2] <= $side[1])
			{
			echo "No solution because 'side c is less than or equal to side b'.";
			}

			if ($side[2] > $side[1])
			{
			$angle[1] = asin(($side[1]*sin($angle[2]))/$side[2])
			$angle[0] = $pi - $angle[1] - $angle[2];
			$side[0] = (($side[2]*sin($angle[0]))/sin($angle[2]);
			}

		}

		elseif ($angle[2] < ($pi/2))
		{

			$height = $side[1]*sin($angle[2]);

			if ($side[2] < $height)
				{
				echo "No solution, the swinging side (c) is shorter than the height.";
				}

			elseif ($side[2] > $height && $side[2] < $side[1])
				{
				echo "Two solutions, h < c < b.";
				$angle[1] = asin(($side[1]*sin($angle[2]))/$side[2]);
				$angle[0] = $pi - $angle[2] - $angle[1];
				$angle_b2 = $pi - $angle[1];
				$angle_a2 = $pi  - $angle[2] - $angle_b2;
				$side_a2 = sqrt((($side[1]*$side[1]) + ($side[2]*$side[2])))-(2*$side[1]*$side[2]*cos($angle_a2)));
				$side[0] = (($side[1]*sin($angle[0]))/sin($angle[1]);
				}

			elseif ($side[2] > $height && $side[2] > $side[1])
				{
				echo "One solution, c > h and c > b.";

				$angle[1] = asin(($side[1]*sin($angle[2]))/$side[2]);
				$angle[0] = $pi - $angle[1] - $angle[2];
				$side[0] = sqrt(($side[1]*$side[1] + $side[2]*$side[2])-(2*$side[1]*$side[2]*cos($angle[0])));
				}

			elseif ($side[2] == $height)
				{
				echo "One solution, c = height.";

				$angle[1] = ($pi/2);
				$angle[0] = $pi - $angle[1] - $angle[2];
				$side[0] = $side[2]*tan($angle[0]);
				}

		}

			elseif ($angle[2] == ($pi/2))
			{
			echo "One solution, Angle B is 90 degrees.";

			$angle[1] = $pi/2
			$angle[0] = $pi - $angle[2] - $angle[1];
			$side[0] = sqrt(($side[1]*$side[1]) - ($side[2]*$side[2]));
			}
		}
	}

	elseif (empty($angle[2])
	{
		if ($angle[1] > ($pi/2)) 
		{
			if ($side[1] <= $side[2])
			{
			echo "No solution because 'side b is less than or equal to side c'.";
			}

			if ($side[1] > $side[2])
			{
			echo "One Solution, b > c.";

			$angle[2] = asin(($side[2]*sin($angle[1]))/$side[1]);
			$angle[0] = $pi - $angle[1] - $angle[2];
			$side[0] = (($side[1]*sin($angle[0]))/sin($angle[1]);
			}

		}

		elseif ($angle[1] < ($pi/2))
		{

		$height = $side[2]*sin($angle[1]);

			if ($side[1] < $height)
				{
				echo "No solution, the swinging side (b) is shorter than the height.";
				}

			elseif ($side[1] > $height && $side[1] < $side[2])
				{
				echo "Two solutions, h < b < c.";
				$angle[2] = asin(($side[2]*sin($angle[1]))/$side[1]);
				$angle[0] = $pi - $angle[1] - $angle[2];
				$angle_c2 = $pi - $angle[2];
				$angle_a2 = $pi  - $angle[1] - $angle_c2;
				$side_a2 = sqrt((($side[1]*$side[1] + ($side[2]*$side[2]))-(2*$side[1]*$side[2]*cos($angle_a2)));
				$side[0] = sqrt((($side[1]*$side[1] + ($side[2]*$side[2]))-(2*$side[1]*$side[2]*cos($angle[0])));
				}

			elseif ($side[1] > $height && $side[1] > $side[2])
				{
				echo "One solution, b > h and b > c.";

				$angle[2] = asin(($side[2]*sin($angle[1]))/$side[1]);
				$angle[0] = $pi - $angle[1] - $angle[2];
				$side[0] = sqrt()($side[1]*$side[1] + ($side[2]*$side[2]))-(2*$side[1]*$side[2]*cos($angle[0])));
				}

			elseif ($side[1] == $height)
				{
				echo "One solution, b = height.";

				$angle[2] = ($pi/2);
				$angle[0] = $pi - $angle[2] - $angle[1];
				$side[0] = sqrt(($side[2]*$side[2]) - ($side[1]*$side[1]));
				}
			}

			elseif ($angle[1] == ($pi/2))
			{
			echo "One Solution, Angle B is 90 degrees.";

			$angle[2] = asin($side[2]/$side[1]);
			$angle[0] = $pi - $angle[1] - $angle[2];
			$side[0] = sqrt(($side[1]*$side[1]) - ($side[2]*side[2]));
			}
	  } 
}




elseif (empty($side[1]))
{
	if (empty($angle[0])
	{
		if ($angle[2] > ($pi/2)) 
		{
			if ($side[2] <= $side[0])
			{
			echo "No solution because 'side a is less than or equal to side c'.";
			}

			if ($side[2] > $side[0])
			{
			$angle[0] = asin(($side[0]*sin($angle[2]))/$side[2])
			$angle[1] = $pi - $angle[0] - $angle[2];
			$side[1] = (($side[1]*sin($angle[2]))/sin($angle[2]);
			}

		}

		elseif ($angle[2] < ($pi/2))
		{

		$height = $side[0]*sin($angle[2]);

			if ($side[2] < $height)
				{
				echo "No solution, the swinging side (c) is shorter than the height.";
				}

			elseif ($side[2] > $height && $side[2] < $side[0])
				{
				echo "Two solutions, h < c < a.";
				$angle[0] = asin(($side[0]*sin($angle[2]))/$side[2]);
				$angle[1] = $pi - $angle[0] - $angle[2];
				$angle_a2 = $pi - $angle[0];
				$angle_b2 = $pi  - $angle[2] - $angle_a2;
				$side_b2 = sqrt((($side[0]*$side[0]) + ($side[2]*$side[2]))-(2*$side[0]*$side[2]*cos($angle_b2)));
				$side[1] = (($side[2]*sin($angle[1]))/sin($angle[2]);
				}

			elseif ($side[2] > $height && $side[2] >= $side[0])
				{
				echo "One solution, c > h and c > a.";

				$angle[0] = asin(($side[0]*sin($angle[2]))/$side[2]);
				$angle[1] = $pi - $angle[0] - $angle[2];
				$side[1] = sqrt((($side[0]*$side[0]) + ($side[2]*$side[2]))-(2*$side[0]*$side[2]*cos($angle[1])));
				}

			elseif ($side[2] == $height)
				{
				echo "One solution, c = height.";

				$angle[0] = ($pi/2);
				$angle[1] = $pi - $angle[0] - $angle[2];
				$side[1] = $side[2]*tan($angle[1]);
				}
			}

		elseif ($angle[2] == ($pi/2))
			{
			echo "One solution, Angle  is 90 degrees.";
			$side[1] = sqrt(($side[2]*$side[2]) - ($side[0]*$side[0]));
			$angle[0] = asin(($side[0]*sin($angle[2])/$side[2]);
			$angle[1] = $pi - $angle[0] - $angle[2];
			}
		}
	}


	elseif (empty($angle[2])
	{
		if ($angle[1] > ($pi/2)) 
		{
			if ($side[1] <= $side[2])
			{
			echo "No solution because 'side  is less than or equal to side '.";
			}

			if ($side[1] > $side[2])
			{
			echo "One Solution, b > c.";

			$angle[2] = asin(($side[2]*sin($angle[1]))/$side[1]);
			$angle[0] = $pi - $angle[1] - $angle[2];
			$side[0] = (($side[0]*sin($angle[2]))/sin($angle[2]);
			}

		}

		elseif ($angle[1] < ($pi/2))
		{

		$height = $side[2]*sin($angle[1]);

			if ($side[1] < $height)
				{
				echo "No solution, the swinging side () is shorter than the height.";
				}

			elseif ($side[1] > $height && $side[1] < $side[2])
				{
				echo "Two solutions, h < b < c.";
				$angle[2] = asin(($side[2]*sin($angle[1]))/$side[1]);
				$angle[0] = $pi - $angle[1] - $angle[2];
				$angle_c2 = $pi - $angle[2];
				$angle_a2 = $pi  - $angle[1] - $angle_c2;
				$side_a2 = sqrt(($side[1]*$side[1] + $side[2]*$side[2])-(2*$side[1]*$side[2]*cos($angle_a2));
				$side[0] = sqrt(($side[1]*$side[1] + $side[2]*$side[2])-(2*$side[1]*$side[1]*cos($angle[0]));
				}

			elseif ($side[1] > $height && $side[1] >= $side[2])
				{
				echo "One solution, b > h and b > c.";

				$angle[2] = asin(($side[2]*sin($angle[1]))/$side[1]);
				$angle[0] = $pi - $angle[1] - $angle[2];
				$side[0] = sqrt(($side[1]*$side[1] + $side[2]*$side[2])-(2*$side[1]*$side[2]*cos($angle[0]));
				}

			elseif ($side[1] == $height)
				{
				echo "One solution, b = height.";

				$angle[2] = ($pi/2);
				$angle[0] = $pi - $angle[1] - $angle[2];
				$side[0] = sqrt(($side[2]*$side[2]) - ($side[1]*$side[1]));
				}
			}

		elseif ($angle[1] == ($pi/2))
			{
			echo "One Solution, Angle B is 90 degrees.";

			$angle[2] = asin($side[2]/$side[1]);
			$angle[0] = $pi - $angle[1] - $angle[2];
			$side[0] = sqrt(($side[1]*$side[1]) - ($side[2]*side[2]));
			}
	}
}




elseif (empty($side[2]))
{
	if (empty($angle[0])
	{
		if ($angle[1] > ($pi/2)) 
		{
			if ($side[1] <= $side[0])
			{
			echo "No solution because 'side b is less than or equal to side a'.";
			}

			if ($side[1] > $side[0])
			{
			$angle[0] = asin(($side[0]*sin($angle[1]))/$side[1])
			$angle[2] = $pi - $angle[0] - $angle[1];
			$side[2] = (($side[1]*sin($angle[2]))/sin($angle[1]);
			}

		}

		elseif ($angle[1] < ($pi/2))
		{

		$height = $side[0]*sin($angle[1]);

			if ($side[1] < $height)
				{
				echo "No solution, the swinging side (b) is shorter than the height.";
				}

			elseif ($side[1] > $height && $side[1] < $side[0])
				{
				echo "Two solutions, h < b < a .";
				$angle[0] = asin(($side[0]*sin($angle[1]))/$side[1]);
				$angle[2] = $pi - $angle[1] - $angle[0];
				$angle_a2 = $pi - $angle[0];
				$angle_c2 = $pi  - $angle[1] - $angle_a2;
				$side_c2 = sqrt((($side[0]*$side[0]) + ($side[1]*$side[1]))-(2*$side[0]*$side[1]*cos($angle_c2)));
				$side[2] = sqrt(($side[1]*$side[1] + $side[0]*$side[0])-(2*$side[1]*$side[0]*cos($angle[2]));
				}

			elseif ($side[] > $height && $side[] >= $side[])
				{
				echo "One solution, b > h and b > a.";

				$angle[0] = asin(($side[0]*sin($angle[1]))/$side[1]);
				$angle[2] = $pi - $angle[1] - $angle[0];
				$side[2] = sqrt((($side[1]*$side[1]) + ($side[0]*$side[0]))-(2*$side[1]*$side[0]*cos($angle[2])));
				}

			elseif ($side[1] == $height)
				{
				echo "One solution, b = height.";

				$angle[0] = ($pi/2);
				$angle[2] = $pi - $angle[1] - $angle[0];
				$side[2] = sqrt(($side[0]*$side[0]) - ($side[1]*$side[1]));
				}
			}

		elseif ($angle[1] == ($pi/2))
			{
			echo "One solution, Angle B is 90 degrees.";
			$side[2] = sqrt(($side[1]*$side[1]) - ($side[0]*$side[0]));
			$angle[0] = asin(($side[0]*sin($angle[1])/$side[1]);
			$angle[2] = $pi - $angle[1] - $angle[0];
			}
		}
	}

	elseif (empty($angle[1])
	{
		if ($angle[0] > ($pi/2)) 
		{
			if ($side[0] <= $side[1])
			{
			echo "No solution because 'side a is less than or equal to side b'.";
			}

			if ($side[0] > $side[1])
			{
			echo "One Solution, a > b.";

			$angle[1] = asin(($side[1]*sin($angle[0]))/$side[0]);
			$angle[2] = $pi - $angle[1] - $angle[0];
			$side[2] = (($side[0]*sin($angle[2]))/sin($angle[0]);
			}

		}

		elseif ($angle[0] < ($pi/2))
		{

		$height = $side[1]*sin($angle[0]);

			if ($side[0] < $height)
				{
				echo "No solution, the swinging side (a) is shorter than the height.";
				}

			elseif ($side[0] > $height && $side[0] < $side[1])
				{
				echo "Two solutions, h < a < c.";
				$angle[1] = asin(($side[1]*sin($angle[0]))/$side[0]);
				$angle[2] = $pi - $angle[0] - $angle[1];
				$angle_b2 = $pi - $angle[1];
				$angle_c2 = $pi  - $angle[0] - $angle_b2;
				$side_c2 = sqrt(($side[1]*$side[1] + $side[0]*$side[0])-(2*$side[1]*$side[0]*cos($angle_c2));
				$side[2] = sqrt(($side[1]*$side[1] + $side[0]*$side[0])-(2*$side[0]*$side[1]*cos($angle[2]));
				}

			elseif ($side[0] > $height && $side[0] >= $side[1])
				{
				echo "One solution, a > h and a > b.";

				$angle[1] = asin(($side[1]*sin($angle[0]))/$side[0]);
				$angle[2] = $pi - $angle[0] - $angle[1];
				$side[2] = sqrt(($side[1]*$side[1] + $side[0]*$side[0])-(2*$side[0]*$side[1]*cos($angle[2]));
				}

			elseif ($side[0] == $height)
				{
				echo "One solution, a = height.";

				$angle[1] = ($pi/2);
				$angle[2] = $pi - $angle[1] - $angle[0];
				$side[2] = sqrt(($side[1]*$side[1]) - ($side[0]*$side[0]));
				}
			}

		elseif ($angle[0] == ($pi/2))
			{
			echo "One Solution, Angle A is 90 degrees.";

			$angle[1] = asin($side[1]/$side[0]);
			$angle[2] = $pi - $angle[0] - $angle[1];
			$side[2] = sqrt(($side[0]*$side[0]) - ($side[1]*side[1]));
			}

	}






?>

 

you had one too many brackets

maybe he just put that to debug but i have site the error like what he said he counts the brases several times

error:

if (empty($angle[1])

elseif (empty($angle[2])

 

if (empty($angle[0])

 

elseif (empty($angle[2])

 

maybe theres still more but thats enough to tell the tread starter his or her error

 

ok @darkfreaks

 

tell me whats wrong with those error i sited  ;D

this error message tells you that } is not a prob

Parse error: syntax error, unexpected '{' in C:\Program Files\Apache Group\Apache2\htdocs\hypotenuse.php on line 470

 

you should aware of those error message LOL ;D

That's because the parser quit and never even got to the extra closing curly brace.  Once the missing parenthesis was fixed, that would have probably been the error the next time through.

this error message tells you that } is not a prob

Parse error: syntax error, unexpected '{' in C:\Program Files\Apache Group\Apache2\htdocs\hypotenuse.php on line 470

 

you should aware of those error message LOL ;D

That's because the parser quit and never even got to the extra closing curly brace.  Once the missing parenthesis was fixed, that would have probably been the error the next time through.

 

your right but you should direct first to the real problem and thats what error message is all about

 

I keep looking and I keep counting the {}.  Every time I think that I don't have one, I can't seem to find the problem.

 

If it isn't a bracket issue...that would be GREAT!

 

Thanks in Advance

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.