I'm building an application to help customer calculate various product prices.
Right now I'm building a feature where user enters a single number to the application and submits a form. Based on that number, I would like to define another variables value.
What I'd like to achieve
If user input is number between 1-10, set variable number to 200.
If user input is number between 11-20, set variable number to 400.
If user input is number between 21-30, set variable number to 600.
If user input is number between 31-40, set variable number to 800.
If user input is number between 41-50, set variable number to 1000.
And so on... So basically increasing by 200 every tenth. Of course, I could do something like this:
$userInput = 11;
$result;
if($userInput => 1 && $userInput =< 10)
$result = 200;
if($userInput => 11 && $userInput =< 20)
$result = 400;
if($userInput => 21 && $userInput =< 30)
$result = 600;
But it isn't really a great solution, because it takes lot of code and if user sets number out of the determined range it doesn't work..
How can I implement this with as little amount of code as possible?