Else recur . Note that this function works even if x is smaller than y because in that case first recursive call exchanges roles of x and y .
return floor ( ( ( int ) $ x / $ y ) + countSteps ( $ y , $ x % $ y ) ) ; }