如何获得投掷的硬币的名称而不是数字

I made a flip a coin game. It consists of three rows. I want the flip number what the flip was and the coin. I have all except the name of the flip like (heads,tails) I am only getting the number that I set for the flip. How do I get the flip to say the word 'heads' for 0 or 'tails' for 1 instead of just 0 or 1. I tried to do it in an echo I still received the number.this is the code I have

<!DOCTYPE html>
 <html>
 <head>
<meta charset="UTF-8">
<meta name="keywords" content="insert, keywords, here">
<meta name="description" content="Insert description here">
<link rel="stylesheet" type="text/css" href="style.css">
<title>Coin</title>
 </head>

<body>

 <header>
<h1> Coin</h1>
</header>
<nav>
</nav>
    <section>
  <h2> Coin</h2>
  <?php
  echo "<table>";
echo "<thead>";
echo "<tr>";

 echo "</tr>";
echo "<thead>";
 echo "<tbody>";
 for($i=0; $i<20; $i++){
 //0 is heads
 //1 is tails
 $result = rand(0, 1);
$count = $i+1;
echo "<tr>";
echo "<td>". $count . "</td>";
echo "<td>" . $result . "</td>";
if($result == 0){

    echo "<td><img src=\"heads.jpg\" alt=\"heads\"></td>";
  } else {
    echo "<td><img src=\"tails.jpg\" alt=\"tails\"></td>";
  }
 echo "</tr>";
 }
  echo "</tbody>";
 echo "</table>";
   ?>
 </section>

 </body>
 </html>

You could map the number to the word you want. For example:

$headsTailsMapping = [];
$headsTailsMapping[0] = "heads"
$headsTailsMapping[1] = "tails"
...
echo "<td>" . $headsTailsMapping[$result] . "</td>";