zeeshan_haider000 Posted March 4, 2009 Share Posted March 4, 2009 Hi, I am trying to find out why this function is not working: <?php $b = $_GET['b']; $c = $_GET['c']; function someFunc($a, $b, $c){ if (!is_numeric($a)){ $result = sqrt (pow($c, 2)-pow($b, 2)); } return $result; } ?> I keep getting the wrong values when i give it some numbers...like when i ask for sqrt of 36+24, it gives me a value of 60 instead of something like 7......? Link to comment https://forums.phpfreaks.com/topic/147859-help/ Share on other sites More sharing options...
corbin Posted March 4, 2009 Share Posted March 4, 2009 Errrrr... I'm sure it's returning what you're telling it to. srqt(c^2 - b^2) And it seems to me that you want sqrt(c-b)? Link to comment https://forums.phpfreaks.com/topic/147859-help/#findComment-776058 Share on other sites More sharing options...
zeeshan_haider000 Posted March 4, 2009 Author Share Posted March 4, 2009 Errrrr... I'm sure it's returning what you're telling it to. srqt(c^2 - b^2) And it seems to me that you want sqrt(c-b)? hmm c^2 - b^2 that's what i want it to return, but instead it outputs something completely different lol... Link to comment https://forums.phpfreaks.com/topic/147859-help/#findComment-776246 Share on other sites More sharing options...
Mark Baker Posted March 4, 2009 Share Posted March 4, 2009 Specifics: What are the values of $b and $c that you're passing to the function? What are you getting back? And what do you expect to get back? Link to comment https://forums.phpfreaks.com/topic/147859-help/#findComment-776273 Share on other sites More sharing options...
zeeshan_haider000 Posted March 4, 2009 Author Share Posted March 4, 2009 Specifics: What are the values of $b and $c that you're passing to the function? What are you getting back? And what do you expect to get back? lol thank you guys but i figured it out what i was doing wrong, i will to fix it ASA i get time....and will see if it's working or not... Link to comment https://forums.phpfreaks.com/topic/147859-help/#findComment-776283 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.