advo Posted August 26, 2010 Share Posted August 26, 2010 hey i have a issue with some math equasions and how to get them to work right so far i did first one and made it work in php =IF(C4>C9;0;IF(B4>B9;0;((B9)*(B9+1)/2*15000)+(B9*2100800)-((B4)*(B4+1)/2*15000)-(2100800*B4))) this is what i got so far from this mind you its just coverting excell equasions but im not math boy and suck bad at maths $costatkweps =(($_POST[noatkwepsto])*($_POST[noatkwepsto]+1)/2*15000)+($_POST[noatkwepsto]*2100800)-(($_POST[noatkweps])*($_POST[noatkweps]+1)/2*15000)-(2100800*$_POST[noatkweps]); if($_POST[noatkweps]>$_POST[noatkwepsto]){ $costatkweps = 0; } if($_POST[atklvl]>$_POST[atklvlto]){ $costatklvl = 0; } ok the first bit of maths works it the second equasion =[color=red]IF(C4>C9;0;IF(B4>B9;0;[/color](10000000*((2^C9)-1))-(10000000*((2^C4)-1)))) the red bit is handled by the if statements and works well, but how do i do the rest so php can add it up, C9 and C4 are the fields so c9=$_POST[atklvlto] and c4 = $_POST[atklvl] i just dont understand how to get this one formular working because of the ^ symbold i think it means 2 to the power of or something but no clue on how to get this one fomualr to add up please help me Quote Link to comment https://forums.phpfreaks.com/topic/211762-some-math-help-please/ Share on other sites More sharing options...
Alex Posted August 26, 2010 Share Posted August 26, 2010 To be honest, I'm not really sure what you're trying to do. But ^ is a bitwise operator; if you're trying to use exponents you need to use pow. Quote Link to comment https://forums.phpfreaks.com/topic/211762-some-math-help-please/#findComment-1103841 Share on other sites More sharing options...
advo Posted August 26, 2010 Author Share Posted August 26, 2010 yeah im trying to convert the excell formual to php i tryed pow but some reason it dosenot add up the same as on my spread sheet which is so frustrating thanks for reply Quote Link to comment https://forums.phpfreaks.com/topic/211762-some-math-help-please/#findComment-1103848 Share on other sites More sharing options...
Alex Posted August 26, 2010 Share Posted August 26, 2010 What does the formula look like in excel? Quote Link to comment https://forums.phpfreaks.com/topic/211762-some-math-help-please/#findComment-1103862 Share on other sites More sharing options...
advo Posted August 26, 2010 Author Share Posted August 26, 2010 =IF(C4>C9;0;IF(B4>B9;0;((B9)*(B9+1)/2*15000)+(B9*2100800)-((B4)*(B4+1)/2*15000)-(2100800*B4))) thats it there it is in first post Quote Link to comment https://forums.phpfreaks.com/topic/211762-some-math-help-please/#findComment-1103929 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.