One line function for factorial of a number | PHP program to find factorial of given number ; single line to find factorial ; Driver Code
< ? php function factorial ( $ n ) { return ( $ n == 1 $ n == 0 ) ? 1 : $ n * factorial ( $ n - 1 ) ; } $ num = 5 ; echo " Factorial ▁ of ▁ " , $ num , " ▁ is ▁ " , factorial ( $ num ) ; ? >