Bayes algorithm implementation with PHP