I have the following code which works for two options,
<?php echo ($color) ? '#111' : '#222';?>
But when I try to add more, I get an error message saying unexected ":" or ";".
<?php echo ($color) ? '#111' : '#222' : '#333' : '#444';?>
How I can adapt this to work with more than two options?
? :is basicallyif(true) { } else { }. You can only ever have two options if all you evaluate is true vs. false, regardless of the syntax or construct you may use. Based on what evaluation do you reckon your other options would ever be chosen?