algo 3 result compare with php seems to be ok