If this is just one block, skip to the later option, as it requires less indentation, shorter, and possibly more readable.
However, note that from now on you will use the first option, because you add elses. They are not necessarily the same:
if ($condition_1) {
if ($condition_2) {
// do something
}
else {
//do something else
}
}
if ($condition_1) {
if ($condition_2) {
// do something
}
}
else {
//do something else
}
source
share