There is something I want to confirm.
I understand that elseif only executes if the preceding if fails.
But how does that work when you have if, elseif, code, then if?
I'm assuming and hoping that the if after the code restart this method of execution.
Here is what I mean in code...
if ($this == 'that') {
// Run code...
}
elseif ($this == 'that') {
// Run code...
}
// Some code here and below...
$assign_new_variable_here = 'This variable';
// Below is if because if can not be elseif
// So does this begin the start of if elseif's??
// Or will php look for both ifs at the start of the function to validate??
if ($this == 'that') {
// Run code...
}
Because naturally my last if I want it to work like an elseif, but is that what PHP is doing anyway because of my code in between stops that if elseif series?
Or should I be writing my code differently? Should I try to declare all my variables in the beginning of the code? It just doesn't seem natural all the time to do so.
Aucun commentaire:
Enregistrer un commentaire