# PHP

## Short, 58

    <?$r=$i=$argv[1];while($i>1){$i--;$r=$r*$i;}echo($r==0?1:$r);

### Tests

0 -> `1`

1 -> `1`

5 -> `120`

125 -> `1.8826771768889E+209`

170 -> `7.257415615308E+306`

171 -> `INF`

*Executes in microseconds.*

### Ungolfed

    <?php
    $r = $i = $argv[1]; // Set $r and $i to Arg.
    while($i > 1) // Calculate while $i bigger than 1
    {
        $i--; // Decrement $i (so it's not infinite)
        $r = $r * $i; // Calculation the Factorial
     }
     echo ($r==0 ? 1: $r); // Output and make 0! = 1
     ?>

## Slighty Longer, 86

    <?$r=$i=(isset($argv[1])?$argv[1]:0);while($i>1){$i--;$r=$r*$i;}echo($r==0?1:$r)."\n";

### Improvements

 - Output with `\n`
 - Doesn't throw error if no arg defined