I would guess they wanted you to figure out that there is a way to do this without writing a loop to "simulate" the prisoner's escape.
Obviously if there were no "slip" it would be trivial --
return ceil($wallheight / $jumpheight) * $walls;
The slip seems to throw a wrench into this equation, but when you consider edge cases it becomes apparent that it can be easily dealt with. What happens if he jumps 5 but slips 4? Suppose a wall height of 10. Jump to 5, slip to 1. Jump to 6, slip to 2. Jump to 7, slip to 3. Jump to 8, slip to 4. Jump to 9, slip to 5. Jump and escape.
So, we can simply remove the jump height from the wall, and then divide the rest by the difference between his jump and his slip (rounding up). Don't forget (as I did!) to add that "last jump" back in!
function count_jumps($jumpheight, $slipheight, $wallheight, $walls) {
if($jumpheight > $wallheight) return $walls;
else return (ceil(($wallheight - $jumpheight) / ($jumpheight - $slipheight)) + 1) * $walls;
}
Edit: Fixed.
Edit 2: Note that this function could possibly produce errors or negative results, but they will all be in situations where the return value would be infinite or undefined (slip >= jump). In an interview situation, you should ask your interviewer how they would want those cases handled.