Write a program to calculate and print the factorial of a number in php

Write a program to calculate and print the factorial of a number in php. Execute the program factorial number what is factorial program and how it works in php language. This script will help you to find the number is factorial or not in PHP

<?php 
$number = 4;
$fact = 1;
for ($x=$number; $x>=1; $x--)
{
$fact = $fact * $x;
}
echo "fact of $number is $fact";
?>

Output:

fact of 4 is 24