n1concepts Posted March 2, 2013 Share Posted March 2, 2013 Hi, I need some help to define a math equation, in PHP, that will determine the variable $y. Example: (1.60 multiplied by 718) then divided by 3550 equals 0.328 (rounded up) Equation: (1.60 * 718) / 3500 = 0.328 ---- What i need to do is define a PHP formatted equation that will pass in the following: $p = 1.60; $c = 3500; $e = 0.328 Which will then determine $y (which in the above example is 718)? Note: should either of the other three variables change ($p, $c, $e), then $y value will dynamically adjust accordingly. ------ Any insight on how this can be defined in PHP appreciation - thx! Note: I know the format - already stated - will work in PHP; I need to figure out how to render $y based on other known variables ($p, $c, $e) That's my issue and my calucations - even knowing 718 is the answer based on those plugged in values - is unknown. thx! Quote Link to comment https://forums.phpfreaks.com/topic/275123-need-to-figure-out-variable-y-structure-to-define-in-php/ Share on other sites More sharing options...
rgopal101 Posted March 2, 2013 Share Posted March 2, 2013 Try This $y=($p * $c) / $e ; Quote Link to comment https://forums.phpfreaks.com/topic/275123-need-to-figure-out-variable-y-structure-to-define-in-php/#findComment-1416002 Share on other sites More sharing options...
n1concepts Posted March 2, 2013 Author Share Posted March 2, 2013 Thanks but that doesn't yield 718; intead 17073. I know this should be simple to define but guess I've been out of school too dog-gone long... LOL!!!! I'll continue to play w/it until i figure it out but thanks! Quote Link to comment https://forums.phpfreaks.com/topic/275123-need-to-figure-out-variable-y-structure-to-define-in-php/#findComment-1416003 Share on other sites More sharing options...
Solution n1concepts Posted March 2, 2013 Author Solution Share Posted March 2, 2013 I figured it out - simple math (had to step thru to get to 2nd step). Always, look for the simple method/answer... Quote Link to comment https://forums.phpfreaks.com/topic/275123-need-to-figure-out-variable-y-structure-to-define-in-php/#findComment-1416011 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.