Factorisation example written in PHP