$word_r){ $word_e_same = $word_r * 2; }else{ $word_e_same = $word_t * 2; } if($word_t >= 1 && $word_r >= 1 && $word_e >= $word_e_same && $word_t > $word_r){ echo $word_r; }else if($word_t >= 1 && $word_r >= 1 && $word_e >= $word_e_same && $word_t < $word_r){ echo $word_t; }else if($word_t >= 1 && $word_r >= 1 && $word_e >= $word_e_same && $word_t == $word_r){ echo $word_t; }else{ echo 0; }