Trying to compress some PHP code

Posted by blachawk on Stack Overflow See other posts from Stack Overflow or by blachawk
Published on 2012-11-06T22:32:32Z Indexed on 2012/11/06 23:00 UTC
Read the original article Hit count: 151

Filed under:

I'm using PHP 5.2.9 at the very moment. Is there a way to compress this code this way it's easier to read or taking less line items?

  if ($is_read_only == true) {
      echo ($affiliate['affiliate_gender'] == 'm') ? MALE : FEMALE;
  } elseif ($error == true) {
      if ($entry_gender_error == true) {
            echo tep_draw_radio_field('a_gender', 'm', $male) . '  ' . MALE . '  ' . tep_draw_radio_field('a_gender', 'f', $female) . '  ' . FEMALE . ' ' . ENTRY_GENDER_ERROR;
      } else {
            echo ($a_gender == 'm') ? MALE : FEMALE;
            echo tep_draw_hidden_field('a_gender');
      }
  } else {
      echo tep_draw_radio_field('a_gender', 'm', $male) . '  ' . MALE . '  ' . tep_draw_radio_field('a_gender', 'f', $female) . '  ' . FEMALE . ' ' . ENTRY_GENDER_TEXT;
  }

© Stack Overflow or respective owner

Related posts about php