0

I am trying to color a row based on a function. I run it to return a color (red, green, ...) that will assign a class.

But what is wrong?

echo "<td class=\"" .  <?php Color($row['Col3']); ?> . "\">" . $row['Col3'] . "</td>";

It is throwing the following error:

PHP Parse error: syntax error, unexpected '<' in D:\App\index.php on line 67

This is the function:

function Color($value) {    
    if ($value > 100) return 'red';
    if ($value < 100) return 'green';
}

I checked it 50 times and can't find where is this unexpected "<". Everything is in place for me.

Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141
Piston
  • 95
  • 1
  • 12

0 Answers0