In my current project, I am having too many if_elseif_else statement in my program. Like this:
<?php
if(){
if(){
if(){
if(){
if(){
if(){
if(){
if(){
}
elseif(){
if(){
}
else(){
}
}
else{
}
}
elseif(){
if(){
}
else{
}
}
elseif(){
if(){
}
}
else{
}
}
else{
}
}
else{
}
}
else{
}
}
else{}
?>
Am wondering if this has any effect on the program and should or not be avoided.
And also, is there a better way to do this?
I read this: Is using too many 'if' statements bad programming in Javascript?
this: Too many 'if' statements in Java? and
this: Too many if statements in Python
but I don't know if they're applicable to PHP.
Thanks.
Aucun commentaire:
Enregistrer un commentaire