16 lines
189 B
PHP
16 lines
189 B
PHP
|
<?php
|
||
|
|
||
|
$num = 4;
|
||
|
$factorial = 1;
|
||
|
for ($x=$num; $x>=1; $x--)
|
||
|
{
|
||
|
$factorial = $factorial * $x;
|
||
|
}
|
||
|
echo "Factorial of $num is $factorial";
|
||
|
|
||
|
?>
|
||
|
|
||
|
/*
|
||
|
Output
|
||
|
|
||
|
Factorial of 4 is 24
|