Recursive program for prime number | Returns true if n is prime , else return false . i is current divisor to check . ; Base cases ; Check for next divisor ; Driver Code
< ? php function isPrime ( $ n , $ i = 2 ) { if ( $ n <= 2 ) return ( $ n == 2 ) ? true : false ; if ( $ n % $ i == 0 ) return false ; if ( $ i * $ i > $ n ) return true ; return isPrime ( $ n , $ i + 1 ) ; } $ n = 15 ; if ( isPrime ( $ n ) ) echo ( " Yes " ) ; else echo ( " No " ) ; ? >