Determine the number of squares of unit area that a given line will pass through . | Function to return the required position ;  ; Driver Code
< ? php function noOfSquares ( $ x1 , $ y1 , $ x2 , $ y2 ) { $ dx = abs ( $ x2 - $ x1 ) ; $ dy = abs ( $ y2 - $ y1 ) ; $ ans = $ dx + $ dy - gcd ( $ dx , $ dy ) ; echo ( $ ans ) ; } function gcd ( $ a , $ b ) { if ( $ b == 0 ) return $ a ; return gcd ( $ b , $ a % $ b ) ; } $ x1 = 1 ; $ y1 = 1 ; $ x2 = 4 ; $ y2 = 3 ; noOfSquares ( $ x1 , $ y1 , $ x2 , $ y2 ) ; ? >