The table represents the characteristics of the product. There is a header group of characteristics and the characteristics themselves. It is necessary to output an array of settings in the form of a table in such a way. And so that the alternation of color always begins with the same color. Option with even and odd know how to do:
foreach($specs_item_full AS $key => $value){ $i++; if($i $i%2 == 0){ echo "<tr style='background-color: #eeeeee'> <td class='spec_title'> $key </td> <td class='spec_details'> $value </td> </tr> "; } else { echo "<tr style='background-color: #e2e2e2'> <td class='spec_title'> $key </td> <td class='spec_details'> $value </td> </tr> "; } }
But how to display the title until I understand. Moreover, in the variant that is indicated above, the alternation does not begin with one color - if there are an even number of elements in the array, then it starts with one color, and if it is odd, it starts with another. If I ended up with different colors, then it is clear, but here it is not clear. The key of the array is the name of the characteristic in Cyrillic, the value is the very value of the characteristic. The title comes with an empty value.