title: Random background color from array - PHP
body: <p>I am a beginner when it comes to programming so I wanted to see if this would be the right way to code this. I was trying to generate a random background color from an array. </p>
  
  <p>If there is something I'm missing or there is something I could do better please let me know.</p>
  
  <pre><code>&lt;?php
      $background_colors = array('#282E33', '#25373A', '#164852', '#495E67', '#FF3838');
  
      $count = count($background_colors) - 1;
  
      $i = rand(0, $count);
  
      $rand_background = $background_colors[$i];
  ?&gt;
  &lt;html&gt;
      &lt;head&gt;
  
      &lt;/head&gt;
      &lt;body style="background: &lt;?php echo $rand_background; ?&gt;;"&gt;
  
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>