Write a PHPscript to find the factorial of a number.

<?php
function factorial($n) {
    return array_product(range(1, $n));
}

$num = 5;//Change this number 
echo "Factorial of $num is " . factorial($num) . ".";
?>