Livello 6.8 del libro di problemi PHP

Задание 1

Dato un testo. All'accesso della pagina, colora ogni carattere del testo in un colore casuale in modo che i caratteri adiacenti abbiano colori diversi. Inserisci il risultato in un paragrafo.

Задание 2

Dato il seguente array:

php<?php
  $arr = [
    ['name' => 'prod1', 'price' => 100, 'amount' => 1],
    ['name' => 'prod2', 'price' => 200, 'amount' => 2],
    ['name' => 'prod3', 'price' => 300, 'amount' => 3],
  ];
?>

Genera utilizzando questo array il seguente codice:

html<table>
  <thead>
    <tr>
      <th>prodotto</th>
      <td>prezzo</td>
      <td>quantità</td>
      <td>totale</td>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>prod1</td>
      <td>100</td>
      <td>1</td>
      <td>100</td>
    </tr>
    <tr>
      <td>prod2</td>
      <td>200</td>
      <td>2</td>
      <td>400</td>
    </tr>
    <tr>
      <td>prod3</td>
      <td>300</td>
      <td>3</td>
      <td>900</td>
    </tr>
  </tbody>
</table>
<br>
totale: <span>1400</span>