Horje
print matrix and color diagonally Code Example
print matrix and color diagonally
$no=9;
echo "<center>";
echo "<div style="overflow-x:auto;">
<TABLE class="w3-table w3-striped w3-bordered w3-border w3-white">";
for ($row=1; $row<=8 ; $row++) { 
	$no--;
	echo "<tr>";
	for ($col=1; $col<=8; $col++) { 
		$color="";
		if ($row==$col) {
			$color = 'background-color:red';
		}
		if ($col==$no) {
			$color = 'background-color:green';	
		}
		echo "<td style=".$color.">".$row*$col."</td>";
	}
	echo "</tr>";
}
echo "</table>";
echo "</center>";
print matrix and color diagonally
$no=9;
echo "<center>";
echo "<div style="overflow-x:auto;">
<TABLE class="w3-table w3-striped w3-bordered w3-border w3-white">";
for ($row=1; $row<=8 ; $row++) { 
	$no--; //to decrement
	echo "<tr>";
	for ($col=1; $col<=8; $col++) { 
		$color="";
		if ($row==$col) {
			$color = 'background-color:red';
		}
		if ($col==$no) { //col val == 8
			$color = 'background-color:green';	
		}
		echo "<td style=".$color.">".$row*$col."</td>";
	}
	echo "</tr>";
}
echo "</table>";
echo "</center>";




Whatever

Related
how to use Py-agender for projects Code Example how to use Py-agender for projects Code Example
how to add extra variable to form post Code Example how to add extra variable to form post Code Example
nim string interpolation Code Example nim string interpolation Code Example
Check if Numbers Are Ascending in a Sentence Code Example Check if Numbers Are Ascending in a Sentence Code Example
istioctl proxy-status Code Example istioctl proxy-status Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8