Check if LCM of array elements is divisible by a prime number or not | Function to check any number of array is divisible by k or not ; If any array element is divisible by k , then LCM of whole array should also be divisible . ; Driver Code
< ? php function func ( $ a , $ k , $ n ) { for ( $ i = 0 ; $ i < $ n ; $ i ++ ) if ( $ a [ $ i ] % $ k == 0 ) return true ; return false ; } $ a = array ( 14 , 27 , 38 , 76 , 84 ) ; $ k = 19 ; $ res = func ( $ a , $ k , 5 ) ; if ( $ res ) echo " true " ; else echo " false " ; ? >