jeudi 2 juillet 2015

Suggest a better way of using this conditional statement

Is there any better way of checking this piece of code,

if (is_string($test) && $test != NULL) {
    $test = 'yes';
} else {
    $test = null;
}

And

 if (is_null($test) || !isset($this->_status[$test])) {
    $icon = null;
} else {
    $icon = $this->getImage($this->_status[$test]);
}

Aucun commentaire:

Enregistrer un commentaire