PHP RAND 和模糊逻辑规则

PHP RAND and fuzzy logic rules

好吧,假设我有变量 a、b 和 c:

a = R R R
b = S S S
c = T T T
number = 1 to 3;

在我的例子中,我需要显示总计的第 27 行 (var * var * var),但结果需要像这样并生成介于 1 到3:

<table>
  <tr>
    <td> R </td>
    <td> R </td>
    <td> R </td>
    <td> number </td>
  </tr>
  <tr>
    <td> R </td>
    <td> R </td>
    <td> S </td>
    <td> number </td>
  </tr>
  <tr>
    <td> R </td>
    <td> S </td>
    <td> T </td>
    <td> number </td>
  </tr>
  <tr>
    <td> S </td>
    <td> S </td>
    <td> R </td>
    <td> number </td>
  </tr>
  <tr>
    <td> S </td>
    <td> T </td>
    <td> S </td>
    <td> number </td>
  </tr>
  <tr>
    <td> S </td>
    <td> T </td>
    <td> T </td>
    <td> number </td>
  </tr>
  <tr>
    <td> T </td>
    <td> R </td>
    <td> R </td>
    <td> number </td>
  </tr>
  <tr>
    <td> T </td>
    <td> R </td>
    <td> S </td>
    <td> number </td>
  </tr>
  <tr>
    <td> T </td>
    <td> S </td>
    <td> T </td>
    <td> number </td>
  </tr>
  <tr>
    <td> R </td>
    <td> S </td>
    <td> R </td>
    <td> number </td>
  </tr>
  <tr>
    <td> R </td>
    <td> T </td>
    <td> S </td>
    <td> number </td>
  </tr>
  <tr>
    <td> R </td>
    <td> T </td>
    <td> T </td>
    <td> number </td>
  </tr>
  <tr>
    <td> S </td>
    <td> R </td>
    <td> R </td>
    <td> number </td>
  </tr>
  <tr>
    <td> S </td>
    <td> R </td>
    <td> S </td>
    <td> number </td>
  </tr>
  <tr>
    <td> S </td>
    <td> S </td>
    <td> T </td>
    <td> number </td>
  </tr>
  <tr>
    <td> T </td>
    <td> S </td>
    <td> R </td>
    <td> number </td>
  </tr>
  <tr>
    <td> T </td>
    <td> T </td>
    <td> S </td>
    <td> number </td>
  </tr>
  <tr>
    <td> T </td>
    <td> T </td>
    <td> T </td>
    <td> number </td>
  </tr>

  <tr>
    <td> R </td>
    <td> R </td>
    <td> R </td>
    <td> number </td>
  </tr>
  <tr>
    <td> R </td>
    <td> R </td>
    <td> S </td>
    <td> number </td>
  </tr>
  <tr>
    <td> R </td>
    <td> S </td>
    <td> T </td>
    <td> number </td>
  </tr>
  <tr>
    <td> S </td>
    <td> S </td>
    <td> R </td>
    <td> number </td>
  </tr>
  <tr>
    <td> S </td>
    <td> T </td>
    <td> S </td>
    <td> number </td>
  </tr>
  <tr>
    <td> S </td>
    <td> T </td>
    <td> T </td>
    <td> number </td>
  </tr>
  <tr>
    <td> T </td>
    <td> R </td>
    <td> R </td>
    <td> number </td>
  </tr>
  <tr>
    <td> T </td>
    <td> R </td>
    <td> S </td>
    <td> number </td>
  </tr>
  <tr>
    <td> T </td>
    <td> S </td>
    <td> T </td>
    <td> number </td>
  </tr>
</table>

我怎样才能在 php 中获得这个结果?

非常感谢任何帮助。 谢谢

给你:

$a = ['R','R','R'];
$b = ['S','S','S'];
$c = ['T','T','T'];

$array = [$a, $b, $c];
<table>
for($i=0 ; i<27; i++) {
  <tr>
    <td> echo $array[rand(0,2)][rand(0,2)] ; </td>
    <td> echo $array[rand(0,2)][rand(0,2)] ; </td>
    <td> echo $array[rand(0,2)][rand(0,2)] ; </td>
    <td> echo rand(0,2)</td>
  </tr>
}
</table>
// !! you need to concat php with HTML !!