n-Step Fibonacci numbers

I coded "n-Step Fibonacci numbers" in PHP.
It can show 3 numbers (tribonacci numbers), 4 numbers (tetranacci numbers), or more.
Now here's the script:

Lately I've been coding in Rails and Chrome Extension, but today I coded PHP after a long interval - half a month.
It's not clear program but I hope this helps.