First collision point of two series | PHP program to calculate the colliding point of two series ; Iterating through n terms of the first series ; x is i - th term of first series ; d is first element of second series and c is common difference for second series . ; If no term of first series is found ; Driver Code
< ? php function point ( $ a , $ b , $ c , $ d , $ n ) { $ x ; $ flag = 0 ; for ( $ i = 0 ; $ i < $ n ; $ i ++ ) { $ x = $ b + $ i * $ a ; if ( ( $ x - $ d ) % $ c == 0 and $ x - $ d >= 0 ) { echo $ x ; $ flag = 1 ; break ; } } if ( $ flag == 0 ) { echo " No ▁ collision ▁ po $ " ; } } $ a = 20 ; $ b = 2 ; $ c = 9 ; $ d = 19 ; $ n = 20 ; point ( $ a , $ b , $ c , $ d , $ n ) ; ? >