lotrfan Posted October 12, 2007 Share Posted October 12, 2007 WARNING: I know this is a MASSIVE function to proofread, so don't feel obligated to help . 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 Quote Link to comment https://forums.phpfreaks.com/topic/73023-solved-parse-error-with-massive-function/ Share on other sites More sharing options...
MmmVomit Posted October 12, 2007 Share Posted October 12, 2007 You're missing a closing parenthesis at the end of the previous line. I do this all the time. Quote Link to comment https://forums.phpfreaks.com/topic/73023-solved-parse-error-with-massive-function/#findComment-368232 Share on other sites More sharing options...
teng84 Posted October 12, 2007 Share Posted October 12, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/73023-solved-parse-error-with-massive-function/#findComment-368242 Share on other sites More sharing options...
teng84 Posted October 12, 2007 Share Posted October 12, 2007 ok got cha check this lines elseif (empty($angle[2]) { tell me whats wrong lol Quote Link to comment https://forums.phpfreaks.com/topic/73023-solved-parse-error-with-massive-function/#findComment-368243 Share on other sites More sharing options...
darkfreaks Posted October 12, 2007 Share Posted October 12, 2007 <?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 Quote Link to comment https://forums.phpfreaks.com/topic/73023-solved-parse-error-with-massive-function/#findComment-368248 Share on other sites More sharing options...
teng84 Posted October 12, 2007 Share Posted October 12, 2007 @darkfreaks you had one too many brackets?????? Quote Link to comment https://forums.phpfreaks.com/topic/73023-solved-parse-error-with-massive-function/#findComment-368251 Share on other sites More sharing options...
darkfreaks Posted October 12, 2007 Share Posted October 12, 2007 teng: he had an extra closing curly bracket on the end also <?php if (empty($angle[1]) ?> should be <?php if (empty($angle[1])) ?> Quote Link to comment https://forums.phpfreaks.com/topic/73023-solved-parse-error-with-massive-function/#findComment-368252 Share on other sites More sharing options...
teng84 Posted October 12, 2007 Share Posted October 12, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/73023-solved-parse-error-with-massive-function/#findComment-368257 Share on other sites More sharing options...
darkfreaks Posted October 12, 2007 Share Posted October 12, 2007 theres no extra closing paren isnt that obv? Quote Link to comment https://forums.phpfreaks.com/topic/73023-solved-parse-error-with-massive-function/#findComment-368259 Share on other sites More sharing options...
teng84 Posted October 13, 2007 Share Posted October 13, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/73023-solved-parse-error-with-massive-function/#findComment-368260 Share on other sites More sharing options...
darkfreaks Posted October 13, 2007 Share Posted October 13, 2007 well i was in Jedit and im telling you there was an extra } that did not match any opening bracket Quote Link to comment https://forums.phpfreaks.com/topic/73023-solved-parse-error-with-massive-function/#findComment-368262 Share on other sites More sharing options...
MmmVomit Posted October 13, 2007 Share Posted October 13, 2007 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 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. Quote Link to comment https://forums.phpfreaks.com/topic/73023-solved-parse-error-with-massive-function/#findComment-368264 Share on other sites More sharing options...
darkfreaks Posted October 13, 2007 Share Posted October 13, 2007 see im not crazy and neither is Jedit Quote Link to comment https://forums.phpfreaks.com/topic/73023-solved-parse-error-with-massive-function/#findComment-368265 Share on other sites More sharing options...
teng84 Posted October 13, 2007 Share Posted October 13, 2007 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 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 Quote Link to comment https://forums.phpfreaks.com/topic/73023-solved-parse-error-with-massive-function/#findComment-368271 Share on other sites More sharing options...
lotrfan Posted October 13, 2007 Author Share Posted October 13, 2007 Thanks guys! I definitely left off a ')' in this line: if (empty($angle[1]) As well as all subsequent lines like it. I'm troubleshooting right now, but I pretty much have it up and going. Thanks again everybody. Quote Link to comment https://forums.phpfreaks.com/topic/73023-solved-parse-error-with-massive-function/#findComment-368362 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.