I assume you've had a go at it yourself by now. Here's my effort...
<?php
$data = [];
for ($r=0; $r<4; $r++) {
for ($c=0; $c<4; $c++) {
$data[$r][$c] = rand(0,1);
}
}
$rowcounts = $colcounts = [];
for ($r=0; $r<4; $r++) {
$rowcounts[$r] = count(array_keys($data[$r], 1));
}
for ($c=0; $c<4; $c++) {
$colcounts[$c] = count(array_keys(array_column($data,$c), 1));
}
$rmax = max($rowcounts);
$cmax = max($colcounts);
$rcmax = max($rmax, $cmax);
$hirows = array_keys($rowcounts, $rcmax);
$hicols = array_keys($colcounts, $rcmax);
echo "<table border='1' style='border-collapse:collapse'>\n";
for ($r=0; $r<4; $r++) {
echo "<tr>";
for ($c=0; $c<4; $c++) {
$hilite = (in_array($r, $hirows) || in_array($c, $hicols)) ? 'class="max"' : '';
echo "<td $hilite> {$data[$r][$c]} </td>";
}
echo "</tr>\n";
}
echo "</table>\n";
?>