I have an array and I need to be able to switch case based on the array values. I've tried the following but something is wrong and it's not working:
$section = array(
'varOne' => 'This is variable One',
'Two' => 'Work with variable Two',
'var_Three' => 'Post var three',
'myDefault' => 'This is my default');
switch($section) {
case 'postProject':
echo section['varOne'];
break;
case 'Two':
echo $section['Two'].$addSomething;
break;
case 'var_Three':
echo $section['var_Three'].$more;
break;
default
echo $section['myDefault'];
}
What am I missing? Basicly I'd like to match case by array's KEY adn output areray's VALUE... Honestly I'm not on a short hand with arrays.