Find if a number is divisible by every number in a list | Function which check is a number divided with every element in list or not ; Driver Code
< ? php function findNoIsDivisibleOrNot ( $ a , $ n , $ l ) { for ( $ i = 0 ; $ i < $ l ; $ i ++ ) { if ( $ a [ $ i ] % $ n != 0 ) return false ; } return true ; } $ a = array ( 14 , 12 , 4 , 18 ) ; $ n = 2 ; $ l = sizeof ( $ a ) ; if ( findNoIsDivisibleOrNot ( $ a , $ n , $ l ) ) echo " Yes " ; else echo " No " ; ? >