From W3c
15.1.1 Background color - bgcolor
attribute has been deprecated in favor of style sheets for specifying background color information.
now what should you do is
function row($year) {
return ($year % 2 == 0) ? "#FFFFFF" : "#000000";
}
for ($year = 2013; $year <= 2023; $year++) {
echo "<tr style='background-color:".row($year).";'><td>$year</td><td>$tdate</td></tr>";
}
however its looks like you are not aware of what ==
does its a equal to operator its not assignment operator
what assignment operator do is assign right hand side value to left hand for example
what Comparison Operators(==
) do is
$a == $b Equal TRUE if $a is equal to $b after type juggling.
second you also there is the scope of a variable
The scope of a variable is the context within which it is defined. For the most part all PHP variables only have a single scope. This single scope spans included and required files as well.
above is quoted from php manual to read more check this