Imagine this:
$array(type=>$user_input);
$level1 = "arbitrary 1";
$level2 = "arbitarty 2";
if( $type && $type != '' ){
switch ($type){
case 'level1':
$levels = $level1;
break;
case 'level2':
$levels = $level2;
break;
}
}else{
$levels = $level1 . $level2;
}
This works, but seems repetitive -- especially with 10, 20 levels...
How would I do this:
$array(type=>$user_input);
$level1 = "arbitrary 1";
$level2 = "arbitarty 2";
if( $type && $type != '' ){
$levels = (use the type contained in the variable named by the user_input)
}else{
$levels = $level1 . $level2;
}
Since I have lost my ability to speak in proper English, I hope my code explanation is self-explanatory.
$array(type=>$user_input);makes absolutely no sense to me... What is this suposed to do?