Find x and y satisfying ax + by = n | function to find the solution ; traverse for all possible values ; check if it is satisfying the equation ; Driver Code
< ? php function solution ( $ a , $ b , $ n ) { for ( $ i = 0 ; $ i * $ a <= $ n ; $ i ++ ) { if ( ( $ n - ( $ i * $ a ) ) % $ b == 0 ) { echo " x = " ▁ , ▁ $ i ▁ , ▁ " , y = " ( $ n - ( $ i * $ a ) ) / $ b ; return ; } } echo " No ▁ solution " ; } $ a = 2 ; $ b = 3 ; $ n = 7 ; solution ( $ a , $ b , $ n ) ; ? >