I would recommend using a language such as R, Python, or Julia for scientific computing. Since I no longer use PHP, I have archived this repository.
This is a pure-PHP library that implements multivariate linear regression using linear algebra. The Moore-Penrose pseudoinverse is used in the computation of the coefficient matrix. The source was written by Shankar Manamalkav, and the original files can be found on his blog.