php - Optimised function layout -


i trying figure out optimized way layout function.

the function has 3 variables, 2 of required.

currently, using conditionals first check round_id, inside round_id conditional, check type, inside if category_id exists (which optional).

does best way run little conditions possible?

 function count() {      var type = *post*; // required     var category_id = *post*; // optional     var round_id = *post*; // required      if ( round_id == "pre" ) {          if ( type == "adult" ) {              if ( category_id ) {              } else {              }          } elseif ( type == "youth" ) {              if ( category_id ) {              } else {              }          }      } elseif ( round_id == "1" ) {          if ( type == "adult" ) {              if ( category_id ) {              } else {              }          } elseif ( type == "youth" ) {              if ( category_id ) {              } else {              }          }      } elseif ( round_id == "2" ) {          if ( type == "adult" ) {              if ( category_id ) {              } else {              }          } elseif ( type == "youth" ) {              if ( category_id ) {              } else {              }          }      } elseif ( round_id == "3" ) {          if ( type == "adult" ) {              if ( category_id ) {              } else {              }          } elseif ( type == "youth" ) {              if ( category_id ) {              } else {              }          }      } else {          error      }  } 


Comments

Popular posts from this blog

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -