simple guessing converted to php from some python exer that i've done