Stooney Posted March 20, 2007 Share Posted March 20, 2007 I'm having a small problem with trying to get a script to run this particular calculation: $points[2] = (2894/( 1+ 259 * e^(-0.0025 * $rating)); im sure the e^ is throwing it off, but im not sure how to go about it differently, im not any good at math. thnx in advance for help. Link to comment https://forums.phpfreaks.com/topic/43509-equation-using-e/ Share on other sites More sharing options...
kenrbnsn Posted March 20, 2007 Share Posted March 20, 2007 You want to use the exp() function: <?php $points[2] = (2894/( 1+ 259 * exp(-0.0025 * $rating)); ?> Ken Link to comment https://forums.phpfreaks.com/topic/43509-equation-using-e/#findComment-211301 Share on other sites More sharing options...
Stooney Posted March 20, 2007 Author Share Posted March 20, 2007 Here's the error im getting on that line: Parse error: parse error, unexpected ';' in /homepages/45/d138243730/htdocs/arena/arena.php on line 12 full script: <form action="arena.php" method="post"> Team Rating <input type="text" name="rating"><br> <?php if($rating!=""){ if($rating > 1500){ $points[2] = (2894/( 1+ 259 * exp(-0.0025 * $rating)); $points[0] = $points[2] * .6; $points[1] = $points[2] * .8; } else{ $points[2] = (0.206*$rating+99); $points[0] = $points[2] * .6; $points[1] = $points[2] * .8; } echo "2v2 = $points[0] <br>"; echo "3v3 = $points[1] <br>"; echo "5v5 = $points[2] <br>"; } ?> Link to comment https://forums.phpfreaks.com/topic/43509-equation-using-e/#findComment-211305 Share on other sites More sharing options...
kenrbnsn Posted March 20, 2007 Share Posted March 20, 2007 You have three opening "(" and two ")" on this line: <?php $points[2] = (2894/( 1+ 259 * exp(-0.0025 * $rating)); ?> Figure out whether there is one too many or one too few. Ken Link to comment https://forums.phpfreaks.com/topic/43509-equation-using-e/#findComment-211308 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.