i love math, and would love to help you, but my linear algrabra class is 2 years away, and therefor have no idea what to do.
is this what your trying to do?
http://mathforum.org/library/drmath/view/53207.html
if not search here for gaussian
http://mathforum.org/dr.math/ a lot of people stop by there for help with algorithm's; if they dont have the one your looking for you can submit a question (make sure you say your a student or they wont reply) and they can give you what you would need to do step by step. After that, if you need help with putting it into php i could try and give you a hand.
hth