Since I'm a music nerd, I created a little script to create a random rhythmic pattern:
echo "X "; for ($beats=rand(0,11); $beats>0; $beats--){ $xo=rand(0,2); if ($xo==0){ echo "x "; } else { echo "- "; } }
It gives a random rhythm of up to 12 beats, where “x” stands for shock, and the first beat is always emphasized. (Output Example: Xxx -)
Now, for the sake of views, I would like to put this data in an html table. I would like the markup for the above example to be like this:
<table border="1"> <tr> <th>Beat:</th> <th>1</th> <th>2</th> <th>3</th> <th>4</th> <th>5</th> <th>6</th> <th>7</th> </tr> <tr> <td>Accent:</td> <td>X</td> <td>-</td> <td>x</td> <td>-</td> <td>x</td> <td>-</td> <td>-</td> </tr> </table>
Alas, my programming skill ends here. Can anyone suggest some code to help with this?
source share