Skip to content

Instantly share code, notes, and snippets.

@cordx56
Last active November 13, 2016 10:04
Show Gist options
  • Save cordx56/5c265e0672e0bd51086921c83fefa706 to your computer and use it in GitHub Desktop.
Save cordx56/5c265e0672e0bd51086921c83fefa706 to your computer and use it in GitHub Desktop.
It outputs '56' to your console. That's all.
<?php
function math_fact($n) {
$r = 1;
for (; $n > 0; $n--) {
$r *= $n;
}
return $r;
}
// 8!/(8-2)! == _8 P _2
$res = math_fact(8) / math_fact(8 - 2);
print $res;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment