What are best practices for displaying randomly selected vocabulary in a table on a PHP page?

When displaying randomly selected vocabulary in a table on a PHP page, it is important to first retrieve the random vocabulary from a database or an array. Then, you can loop through the vocabulary and display it in a table format using HTML and PHP.

<?php
// Sample array of vocabulary words
$vocabulary = array("apple", "banana", "carrot", "dog", "elephant");

// Shuffle the array to get a random order
shuffle($vocabulary);

// Display the vocabulary in a table
echo "<table>";
echo "<tr><th>Random Vocabulary</th></tr>";
foreach ($vocabulary as $word) {
    echo "<tr><td>$word</td></tr>";
}
echo "</table>";
?>