hi all i have a problem not solved by me the math equation in php. following is behavior what i want. i have 5 digits ( 1 , 2 , 3 , 4 , 5) if it is 1 then provide a equation that return a digit -15 if it is 2 then provide a equation that return a digit -12 if it is 3 then provide a equation that return a digit -9 if it is 4 then provide a equation that return a digit -6 if it is 5 then provide a equation that return a digit -3 equation must same for all digits. explained again as: 1 equation = -15 2 equation = -12 3 equation = -9 4 equation = -6 5 equation = -3 what will be equation? i will be very thank full to try to solve my problem.
thanks jinGKing but i want to solve it by just one equation. i am working on a site that will be handle by this equation. not by lengthy code.
I think this is more a math problem than a PHP problem Try to post in math forums. Come back when you have the equation and we'll do the php part...
Well, it seems a rather simple problem to me: y = 3x - 18 If x = 1, y = -15 If x = 2, y = -12 If x = 3, y = -9 If x = 4, y = -6 If x = 5, y = -3 Hence: $result = (3 * $input) - 18 Code (markup):