Menu
Hi,
I have a quick question regarding the best PHP Code structure.
What is better to do:
[B]EXAMPLE 1
[code=php] if( STATEMENT 1 ){
if( STATEMENT 2 ){
//EXECUTE CODE HERE
}else{
exit;
}
}else{
exit;
}
Or [B]EXAMPLE 2
[code=php] if (! STATEMENT 1){
exit;
}
if (! STATEMENT 2){
exit;
}
//EXECUTE CODE HERE
Is it better to code using a technique where you go deeper and deeper in the code following only if statement is met or is it better to do simple error check and just always stays “out” of the if statements?
I bet theres not much of a difference, but overall, which way should I choose?
Thanks guys!
?