Factorial of a non-negative integer, is multiplication of all integers smaller than or equal to n. For example factorial of 5 is 5*4*3*2*1 which is 120.

Factorial of number 5

<?php
$num = 5;
$factorial =1;
for($i=1; $i<=$num; $i++) {
	$factorial = $factorial * $i;
  echo $i."";
}
echo "Factorial of $num is $factorial";
?>

OUTPUT: Factorial of 5 is 120