Jump to content

PHP Conditional Formatting


mattheww

Recommended Posts

The correct answer depens on what your cell looks like when you type in 3 and 4. If red and blue are the only possible colors you could use something like:

 

$value % 2 === 0 ? 'blue' : 'red'

 

If the colors keep changing:

$colors = array('red', 'blue', 'orange', .., 'purple');
print $colors[$value - 1];

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.