PHP - logic - if else / or die?

39 Views Asked by At

A simple question, I have this following code:

if ($this->someSecurityCheck()) {
   // do stuff

} else {
   // show alert message
   redirect(‘index');
}

and for better legibility (the code is big), I’m wondering to change it to:

if (!$this->someSecurityCheck()) {
   // show alert message
   redirect(‘index');
   die();
}

// do stuff

I know that both should work, but the second seems logically „incorrect“. Any thoughts?

0

There are 0 best solutions below