use formula for calculating correlation coefficient .
$ corr = ( float ) ( $ n * $ sum_XY - $ sum_X * $ sum_Y ) / sqrt ( ( $ n * $ squareSum_X - $ sum_X * $ sum_X ) * ( $ n * $ squareSum_Y - $ sum_Y * $ sum_Y ) ) ; return $ corr ; }