Function to return the count of steps
function countSteps ( $ curx , $ cury , $ n , $ m , $ moves ) { $ count = 0 ; $ k = sizeof ( $ moves ) ; for ( $ i = 0 ; $ i < $ k ; $ i ++ ) { $ x = $ moves [ $ i ] [ 0 ] ; $ y = $ moves [ $ i ] [ 1 ] ;