$word_r){ $word_e_same = $word_r * 2; }else{ $word_e_same = $word_t * 2; } $word_e_diff = floor($word_e / 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 if($word_t >= 1 && $word_r >= 1 && $word_e < $word_e_same && $word_e >= 2){ echo $word_e_diff; }else{ echo 0; }