Factorial folder and algorithm with PHP