mardi 11 août 2015

Is it good to use lots of and condition in if statement?

I've a code something like this, i just want to know is it good habit to use lots of 'and' 'or' in a single if statement

if (array_key_exists(self::SUB_FORM_CONTACT, $data) &&
            array_key_exists('company', $data[self::SUB_FORM_CONTACT]) &&
            ((array_key_exists('salesRegion', $data[self::SUB_FORM_CONTACT]['company']) && !empty($data[self::SUB_FORM_CONTACT]['company']['salesRegion'])) ||
                (array_key_exists('serviceRegion', $data[self::SUB_FORM_CONTACT]['company']) && !empty($data[self::SUB_FORM_CONTACT]['company'][''])))
        ) {

        }

Or is there any better way of doing this?

Aucun commentaire:

Enregistrer un commentaire