user2488832 user2488832 - 11 months ago 60
PHP Question

How to bold array elements in html table?

I'm trying to solve an exercise, but don't know how to go on. I need to make bold table's diagonal letters, like show on this picture:

enter image description here

Here's my code:

if (isset($_GET['word'])) {
$word = strtolower($_GET['word']);
$arr = str_split($word);}
else {

<!DOCTYPE html>
<meta charset="utf-8">
<style type="text/css">
td {
width: 20px;
height: 20px;
text-align: center;

table {border-collapse:collapse;}
<form action="tabel.php" method="get">
word: <input type="text" name="word"><input type="submit">
if (isset($arr)){
for ($i=0; $i < count($arr); $i++) {
foreach ($arr as $taht) { ?>
<table border="1" style="display:inline-table;">
<td><?php echo $taht;?></td>
?> <br> <?php
else {}


Answer Source

As i said in my very first comment :

for($i .....)
  for($j ....)
     if($i == $j)    echo "<b>.....