title: Can you solve this thing that i was asked in php interview?
body: <p>Write a function in <strong>php</strong> to find out the number of jumps the prisoner makes to escape from the jail.</p>
  
  <p>A prisoner escapes from the jail by jumping over a wall. He can jump <em>x</em> meters of height, but after every jump he slips <em>y</em> meters.</p>
  
  <p>The function should take <strong>four arguments</strong> which are:</p>
  
  <ol>
   <li> Max height he can jump</li>
   <li> Number of meters he slips down the wall</li>
   <li> Height of the wall</li>
   <li> Number of walls</li>
  </ol>
  
  <p>For example: (<strong>10,1,11,2</strong>):<br><br></p>
  
  <p>This means that the prisoner can jump <strong>10</strong> meters in <em>height</em>.<br>
  He <em>slips down</em> <strong>1</strong> meter after every jump he makes.<br>
  <em>Wall height</em> is <strong>11</strong> meters.<br>
  There are <strong>2</strong> <em>walls</em>.<br></p>
  
  <p>The <strong>output</strong> of this question should be : <strong>4</strong> (my guess)</p>
  
  <p>Explanation: <br><br>
  In his <strong>first jump</strong> reaches 10 meter height but slip down 1 meter so the effective jump height was 9 meter,then in the <strong>second jump</strong> he starts from that 9 meter point and makes one more and successfully manages to climb the first wall. To climb the second wall he has to go through the same process again.</p>
  
  <p>I am not good in math. That's why I couldn't figure out how to put them together and make an equation out of them.</p>
  
  <p>This question was asked when I was applying as fresher php developer. Do you think asking this kind of question to a fresher was justified?</p>