lundi 11 juillet 2016

If and Else or define as one value and only change if, if statement passes [on hold]

This is what i mean

$data = false
if($var === 'SomeString'){
    $data = true;
}

As Opposed to this

if($var === 'SomeString'){
    $data = true
}else{
    $data = false;
}

Is it just developer preference or is there reason behind using one or the other?

Aucun commentaire:

Enregistrer un commentaire